Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions experimental/torch_xla2/test/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@
"linalg.vector_norm",
"linspace",
"log_normal",
"log_softmax",
"logaddexp2",
"logaddexp",
"logcumsumexp",
Expand Down Expand Up @@ -252,8 +251,6 @@
"scatter",
"scatter_reduce",
"searchsorted",
"softmax",
"sort",
"special.airy_ai",
"special.modified_bessel_i1",
"special.modified_bessel_k0",
Expand Down
6 changes: 6 additions & 0 deletions experimental/torch_xla2/torch_xla2/ops/jaten.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ def _aten_stack(tensors, dim=0):

@op(torch.ops.aten._softmax)
def _aten_softmax(x, dim, halftofloat):
if x.shape == ():
return jnp.astype(1.0, x.dtype)
return jax.nn.softmax(x, dim)


Expand Down Expand Up @@ -1947,6 +1949,8 @@ def _aten_logical_not(self):
# aten.log_softmax
@op(torch.ops.aten._log_softmax)
def _aten_log_softmax(self, axis=-1, half_to_float=False):
if self.shape == ():
return jnp.astype(0.0, self.dtype)
return jax.nn.log_softmax(self, axis)


Expand Down Expand Up @@ -2024,6 +2028,8 @@ def _aten_slice_scatter(input, src, dim=0, start=None, end=None, step=1):
# torch.sort(input, dim=-1, descending=False, stable=False, *, out=None)
@op(torch.ops.aten.sort)
def _aten_sort(a, dim=-1, descending=False, stable=False):
if a.shape == ():
return (a, jnp.astype(0, 'int64'))
return (
jnp.sort(a, axis=dim, stable=stable, descending=descending),
jnp.argsort(a, axis=dim, stable=stable, descending=descending),
Expand Down