xbarray 0.0.1a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of xbarray might be problematic. Click here for more details.
- array_api_typing/__init__.py +9 -0
- array_api_typing/typing_2024_12/__init__.py +12 -0
- array_api_typing/typing_2024_12/_api_constant.py +32 -0
- array_api_typing/typing_2024_12/_api_fft_typing.py +717 -0
- array_api_typing/typing_2024_12/_api_linalg_typing.py +897 -0
- array_api_typing/typing_2024_12/_api_return_typing.py +103 -0
- array_api_typing/typing_2024_12/_api_typing.py +5855 -0
- array_api_typing/typing_2024_12/_array_typing.py +1265 -0
- array_api_typing/typing_compat/__init__.py +12 -0
- array_api_typing/typing_compat/_api_typing.py +27 -0
- array_api_typing/typing_compat/_array_typing.py +36 -0
- array_api_typing/typing_extra/__init__.py +12 -0
- array_api_typing/typing_extra/_api_typing.py +651 -0
- array_api_typing/typing_extra/_at.py +87 -0
- xbarray/__init__.py +1 -0
- xbarray/base/__init__.py +1 -0
- xbarray/base/base.py +199 -0
- xbarray/common/implementations.py +61 -0
- xbarray/jax/__init__.py +25 -0
- xbarray/jax/_extra.py +98 -0
- xbarray/jax/_typing.py +15 -0
- xbarray/jax/random.py +116 -0
- xbarray/numpy/__init__.py +19 -0
- xbarray/numpy/_extra.py +83 -0
- xbarray/numpy/_typing.py +14 -0
- xbarray/numpy/random.py +106 -0
- xbarray/pytorch/__init__.py +20 -0
- xbarray/pytorch/_extra.py +109 -0
- xbarray/pytorch/_typing.py +13 -0
- xbarray/pytorch/random.py +102 -0
- xbarray-0.0.1a1.dist-info/METADATA +14 -0
- xbarray-0.0.1a1.dist-info/RECORD +35 -0
- xbarray-0.0.1a1.dist-info/WHEEL +5 -0
- xbarray-0.0.1a1.dist-info/licenses/LICENSE +21 -0
- xbarray-0.0.1a1.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
from typing import Protocol, TypeVar, Optional, Any, Tuple, Union, Type, TypedDict, List, TypeAlias
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from abc import abstractmethod
|
|
4
|
+
from ._array_typing import Device, DType
|
|
5
|
+
|
|
6
|
+
__all__ = [
|
|
7
|
+
"SupportsBufferProtocol",
|
|
8
|
+
"DefaultDataTypes",
|
|
9
|
+
"DataTypes",
|
|
10
|
+
"Capabilities",
|
|
11
|
+
"finfo_object",
|
|
12
|
+
"iinfo_object",
|
|
13
|
+
"NestedSequence",
|
|
14
|
+
"Info"
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
SupportsBufferProtocol = TypeVar("SupportsBufferProtocol")
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
https://github.com/data-apis/array-api/blob/main/src/array_api_stubs/_2024_12/_types.py#L55
|
|
21
|
+
"""
|
|
22
|
+
DefaultDataTypes = TypedDict(
|
|
23
|
+
"DefaultDataTypes",
|
|
24
|
+
{
|
|
25
|
+
"real floating": DType,
|
|
26
|
+
"complex floating": DType,
|
|
27
|
+
"integral": DType,
|
|
28
|
+
"indexing": DType,
|
|
29
|
+
},
|
|
30
|
+
)
|
|
31
|
+
DataTypes = TypedDict(
|
|
32
|
+
"DataTypes",
|
|
33
|
+
{
|
|
34
|
+
"bool": DType,
|
|
35
|
+
"float32": DType,
|
|
36
|
+
"float64": DType,
|
|
37
|
+
"complex64": DType,
|
|
38
|
+
"complex128": DType,
|
|
39
|
+
"int8": DType,
|
|
40
|
+
"int16": DType,
|
|
41
|
+
"int32": DType,
|
|
42
|
+
"int64": DType,
|
|
43
|
+
"uint8": DType,
|
|
44
|
+
"uint16": DType,
|
|
45
|
+
"uint32": DType,
|
|
46
|
+
"uint64": DType,
|
|
47
|
+
},
|
|
48
|
+
total=False,
|
|
49
|
+
)
|
|
50
|
+
Capabilities = TypedDict(
|
|
51
|
+
"Capabilities",
|
|
52
|
+
{
|
|
53
|
+
"boolean indexing": bool,
|
|
54
|
+
"data-dependent shapes": bool,
|
|
55
|
+
"max rank": Optional[int],
|
|
56
|
+
},
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
@dataclass
|
|
60
|
+
class finfo_object:
|
|
61
|
+
"""Dataclass returned by `finfo`."""
|
|
62
|
+
bits: int
|
|
63
|
+
eps: float
|
|
64
|
+
max: float
|
|
65
|
+
min: float
|
|
66
|
+
smallest_normal: float
|
|
67
|
+
dtype: DType
|
|
68
|
+
|
|
69
|
+
@dataclass
|
|
70
|
+
class iinfo_object:
|
|
71
|
+
"""Dataclass returned by `iinfo`."""
|
|
72
|
+
bits: int
|
|
73
|
+
max: int
|
|
74
|
+
min: int
|
|
75
|
+
dtype: DType
|
|
76
|
+
|
|
77
|
+
_T_co = TypeVar("_T_co", covariant=True)
|
|
78
|
+
class NestedSequence(Protocol[_T_co]):
|
|
79
|
+
def __getitem__(self, key: int, /) -> Union[_T_co, 'NestedSequence[_T_co]']:
|
|
80
|
+
...
|
|
81
|
+
|
|
82
|
+
def __len__(self, /) -> int:
|
|
83
|
+
...
|
|
84
|
+
|
|
85
|
+
class Info(Protocol):
|
|
86
|
+
"""Namespace returned by `__array_namespace_info__`."""
|
|
87
|
+
|
|
88
|
+
def capabilities(self) -> Capabilities:
|
|
89
|
+
...
|
|
90
|
+
|
|
91
|
+
def default_device(self) -> Device:
|
|
92
|
+
...
|
|
93
|
+
|
|
94
|
+
def default_dtypes(self, *, device: Optional[Device]) -> DefaultDataTypes:
|
|
95
|
+
...
|
|
96
|
+
|
|
97
|
+
def devices(self) -> List[Device]:
|
|
98
|
+
...
|
|
99
|
+
|
|
100
|
+
def dtypes(
|
|
101
|
+
self, *, device: Optional[Device], kind: Optional[Union[str, Tuple[str, ...]]]
|
|
102
|
+
) -> DataTypes:
|
|
103
|
+
...
|