Skip to content

Commit

Permalink
fix: Few simple changes to make the code better (#26329)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sai-Suraj-27 authored Oct 10, 2023
1 parent 8608b7f commit a7d8582
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Please use this format to link other issues with their numbers: Close #123
https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
-->

Close #
Closes #

## Checklist

Expand Down
2 changes: 1 addition & 1 deletion ivy/func_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ def _leaf_has_nans(x):
return x.has_nans()
elif ivy.is_array(x):
return ivy.isnan(x).any()
elif x == float("nan"):
elif np.isnan(x):
return True
return False

Expand Down
8 changes: 4 additions & 4 deletions ivy/functional/frontends/numpy/func_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,21 +243,21 @@ def _from_zero_dim_arrays_to_scalar(*args, **kwargs):
ret_idx,
lambda x: np_frontend.numpy_dtype_to_scalar[ivy.dtype(x)](x),
)
except KeyError:
except KeyError as e:
raise ivy.utils.exceptions.IvyException(
"Casting to specified type is unsupported"
)
) from e
return tuple(data)
else:
# converting the scalar to float
data = ivy.native_array(ret)
if data.shape == ():
try:
return np_frontend.numpy_dtype_to_scalar[ivy.dtype(data)](data)
except KeyError:
except KeyError as e:
raise ivy.utils.exceptions.IvyException(
f"Casting to {ivy.dtype(data)} is unsupported"
)
) from e
return ret

_from_zero_dim_arrays_to_scalar.from_zero_dim_arrays_to_scalar = True
Expand Down

0 comments on commit a7d8582

Please sign in to comment.