Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement dist in torch aten ops #8019

Merged
merged 1 commit into from
Sep 16, 2024
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
1 change: 0 additions & 1 deletion experimental/torch_xla2/test/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"diagonal_scatter",
"diff",
"digamma",
"dist",
"erfc",
"erfinv",
"expand",
Expand Down
4 changes: 4 additions & 0 deletions experimental/torch_xla2/torch_xla2/ops/jaten.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@ def _aten_div(x, y, rounding_mode=""):
def _aten_true_divide(x, y):
return x / y

@op(torch.ops.aten.dist)
def _aten_dist(input, other, p=2):
diff = jnp.abs(jnp.subtract(input, other))
return _aten_linalg_vector_norm(diff, ord=p)

@op(torch.ops.aten.bmm)
def _aten_bmm(x, y):
Expand Down
Loading