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

Allow nan functions to work with xarray #670

Merged
merged 1 commit into from
Feb 6, 2025
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
4 changes: 2 additions & 2 deletions cubed/array/nan_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
# https://github.com/data-apis/array-api/issues/621


def nanmean(x, /, *, axis=None, keepdims=False, split_every=None):
def nanmean(x, /, *, axis=None, dtype=None, keepdims=False, split_every=None):
"""Compute the arithmetic mean along the specified axis, ignoring NaNs."""
dtype = x.dtype
dtype = dtype or x.dtype
intermediate_dtype = [("n", nxp.int64), ("total", nxp.float64)]
return reduction(
x,
Expand Down
4 changes: 2 additions & 2 deletions cubed/array_api/array_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ def __array_namespace__(self, /, *, api_version=None):
"2023.12",
):
raise ValueError(f"Unrecognized array API version: {api_version!r}")
import cubed.array_api as array_api
import cubed

return array_api
return cubed

def __bool__(self, /):
if self.ndim != 0:
Expand Down