Add isnan (#423)

This commit is contained in:
Ayush Shridhar
2024-01-12 14:16:48 -05:00
committed by GitHub
parent 29081204d1
commit 1416e7b664
7 changed files with 72 additions and 0 deletions

View File

@@ -1132,6 +1132,12 @@ void init_array(py::module_& m) {
py::kw_only(),
"stream"_a = none,
"See :func:`any`.")
.def(
"isnan",
&mlx::core::isnan,
py::kw_only(),
"stream"_a = none,
"See :func:`isnan`.")
.def(
"moveaxis",
&moveaxis,

View File

@@ -1820,6 +1820,24 @@ void init_ops(py::module_& m) {
Returns:
array: The ceil of ``a``.
)pbdoc");
m.def(
"isnan",
&mlx::core::isnan,
"a"_a,
py::pos_only(),
py::kw_only(),
"stream"_a = none,
R"pbdoc(
isnan(a: array, stream: Union[None, Stream, Device] = None) -> array
Return a boolean array indicating which elements are NaN.
Args:
a (array): Input array.
Returns:
array: The array with boolean values indicating which elements are NaN.
)pbdoc");
m.def(
"moveaxis",
&moveaxis,