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

enable linalg.vector_norm tests #8249

Merged
merged 1 commit into from
Oct 10, 2024
Merged

Conversation

barney-s
Copy link
Contributor

enable linalg.vector_norm tests

  • for ord==0 case typecast back to the input type

fixes: #7505
ref: #7505 (comment)

* for ord==0 case typecast back to the input type
@@ -1290,7 +1290,8 @@ def _aten_linalg_vector_norm(self, ord=2, dim=None, keepdim=False, dtype=None):
# Special cases (for efficiency and clarity)
if ord == 0:
if self.shape == ():
result = jnp.array(float(self != 0))
# float sets it to float64. set it back to input type
result = jnp.astype(jnp.array(float(self != 0)), self.dtype)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without this the failure seen was:

FAILED test/test_ops.py::TestOpInfoCPU::test_reference_eager_linalg_vector_norm_cpu_float32 - AssertionError: The values for attribute 'dtype' do not match: torch.float64 != torch.float32.

Copy link
Collaborator

@ManfeiBai ManfeiBai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@ManfeiBai ManfeiBai merged commit fe03cd2 into pytorch:master Oct 10, 2024
3 checks passed
anishfish2 pushed a commit to anishfish2/xla that referenced this pull request Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Op info test for linalg.tensorsolve .. log_normal
2 participants