Skip to content

Commit 422a89c

Browse files
committed
Tensor flip call backend flip
1 parent b0194e3 commit 422a89c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

quimb/tensor/tensor_core.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -2960,10 +2960,8 @@ def flip(self, ind, inplace=False):
29602960
raise ValueError(f"Can't find index {ind} on this tensor.")
29612961

29622962
t = self if inplace else self.copy()
2963-
flipper = tuple(
2964-
slice(None, None, -1) if i == ind else slice(None) for i in t.inds
2965-
)
2966-
t.modify(apply=lambda x: x[flipper])
2963+
ax = t.inds.index(ind)
2964+
t.modify(apply=lambda x: do("flip", x, ax))
29672965
return t
29682966

29692967
flip_ = functools.partialmethod(flip, inplace=True)

0 commit comments

Comments
 (0)