Skip to content

Commit

Permalink
Fix unbind op.
Browse files Browse the repository at this point in the history
The test passed with the previous implementation but I created a
slightly more efficient one anyway.
  • Loading branch information
cornmander committed Sep 17, 2024
1 parent 0da723f commit 3e2bb26
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions experimental/torch_xla2/torch_xla2/ops/jaten.py
Original file line number Diff line number Diff line change
Expand Up @@ -2399,10 +2399,7 @@ def _aten_trunc(a):
@op(torch.ops.aten.unbind)
@op(torch.ops.aten.unbind_copy)
def _aten_unbind(a, dim=0):
return tuple(
_aten_squeeze_dim(jax.lax.index_in_dim(a, i, axis=dim), dim)
for i in range(a.shape[dim])
)
return [lax.index_in_dim(a, i, axis, keepdims=False) for i in range(a.shape[axis])]


# NOTE: skip aten.upsample_nearest2d and aten.upsample_bilinear2d
Expand Down

0 comments on commit 3e2bb26

Please sign in to comment.