-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Christian Bourjau <[email protected]>
- Loading branch information
1 parent
d9802b0
commit 4d70e5a
Showing
15 changed files
with
172 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "array-api-tests"] | ||
path = api-coverage-tests | ||
[submodule "api-coverage-tests"] | ||
path = array-api-tests | ||
url = [email protected]:data-apis/array-api-tests.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule api-coverage-tests
deleted from
4caff2
Submodule array-api-tests
added at
dad773
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Copyright (c) QuantCo 2023-2025 | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
from __future__ import annotations | ||
|
||
import ndonnx as ndx | ||
from ndonnx._array import _Device, device | ||
from ndonnx._data_types import canonical_name | ||
|
||
|
||
class ArrayNamespaceInfo: | ||
"""Namespace metadata for the Array API standard.""" | ||
|
||
_all_array_api_types = [ | ||
ndx.bool, | ||
ndx.float32, | ||
ndx.float64, | ||
ndx.int8, | ||
ndx.int16, | ||
ndx.int32, | ||
ndx.int64, | ||
ndx.uint8, | ||
ndx.uint16, | ||
ndx.uint32, | ||
ndx.uint64, | ||
] | ||
|
||
def capabilities(self) -> dict[str, bool]: | ||
return { | ||
"boolean indexing": True, | ||
"data-dependent shapes": True, | ||
} | ||
|
||
def default_device(self) -> _Device: | ||
return device | ||
|
||
def devices(self) -> list[_Device]: | ||
return [device] | ||
|
||
def dtypes( | ||
self, *, device=None, kind: str | tuple[str, ...] | None = None | ||
) -> dict[str, ndx.CoreType]: | ||
out: dict[str, ndx.CoreType] = {} | ||
for dtype in self._all_array_api_types: | ||
if kind is None or ndx.isdtype(dtype, kind): | ||
out[canonical_name(dtype)] = dtype | ||
return out | ||
|
||
def default_dtypes( | ||
self, | ||
*, | ||
device=None, | ||
) -> dict[str, ndx.CoreType]: | ||
return { | ||
"real floating": ndx.float64, | ||
"integral": ndx.int64, | ||
"indexing": ndx.int64, | ||
} | ||
|
||
|
||
def __array_namespace_info__() -> ArrayNamespaceInfo: # noqa: N807 | ||
return ArrayNamespaceInfo() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters