Skip to content

Commit

Permalink
Fix stacking compact sparse tensors with different sparsity patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Holl committed Aug 22, 2024
1 parent a492eb4 commit 2acb040
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion phiml/math/_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ def stack_tensors(values: Union[tuple, list], dim: Shape):
return NativeTensor(values[0]._native, values[0]._native_shape, values[0].shape & dim.with_size(1))
# --- not directly stackable ---
non_stackable = broadcast_dims(*values)
if non_stackable:
if non_stackable or any(is_sparse(v) for v in values): # stackable sparse would have been handled by __stack__() before calling this function
return TensorStack(values, dim)
if any(v._is_tracer for v in values):
return TensorStack(values, dim)
Expand Down

0 comments on commit 2acb040

Please sign in to comment.