Skip to content

Commit

Permalink
Merge pull request #109 from adtzlr/try-stack-only-real
Browse files Browse the repository at this point in the history
Use only `A.x` in `try_stack()`
  • Loading branch information
adtzlr authored May 14, 2024
2 parents 194b0f1 + 3fc5e76 commit 15d12f2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/tensortrax/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
tensorTRAX: Math on (Hyper-Dual) Tensors with Trailing Axes.
"""

__version__ = "0.21.2"
__version__ = "0.21.3"
2 changes: 1 addition & 1 deletion src/tensortrax/math/special/_special_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ def from_triu_2d(A):
def try_stack(arrays, fallback=None):
"Try to unpack and stack the list of tensors and return the fallback otherwise."
try:
return stack([A for ary in arrays for A in ary])
return stack([A.x for ary in arrays for A in ary])
except ValueError:
return fallback
2 changes: 1 addition & 1 deletion tests/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def test_try_stack():
fallback = "my fallback"

stacked = tm.special.try_stack([C6, C6], fallback=fallback)
assert stacked.shape == (12,)
assert stacked.shape[0] == 12

assert tm.special.try_stack([C, C6], fallback=fallback) == fallback
with pytest.raises(ValueError):
Expand Down

0 comments on commit 15d12f2

Please sign in to comment.