Skip to content

Commit

Permalink
fix: resolve failing test cases for torch.linalg.norm (#28805)
Browse files Browse the repository at this point in the history
Co-authored-by: adityadeshmukh369 <[email protected]>
Co-authored-by: Sam Armstrong <[email protected]>
  • Loading branch information
3 people committed Aug 19, 2024
1 parent fe0f62d commit ee80264
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ivy/functional/frontends/torch/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ def norm(input, ord=None, dim=None, keepdim=False, *, dtype=None, out=None):
raise RuntimeError(
f"linalg.norm: If dim is specified, it must be of length 1 or 2. Got {dim}"
)
if dtype == "complex64":
ret = ivy.astype(ret, "float32")
elif dtype == "complex128":
ret = ivy.astype(ret, "float64")
return ret


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def _get_axis_and_p(draw):
helpers.dtype_values_axis(
available_dtypes=helpers.get_dtypes("valid"),
min_num_dims=2,
max_num_dims=4,
valid_axis=True,
min_value=-1e04,
max_value=1e04,
Expand Down

0 comments on commit ee80264

Please sign in to comment.