File tree Expand file tree Collapse file tree 3 files changed +92
-39
lines changed Expand file tree Collapse file tree 3 files changed +92
-39
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
3
__all__ = [
4
- "ndarray" ,
5
- "Device" ,
6
- "Dtype" ,
7
4
"NestedSequence" ,
8
5
"SupportsBufferProtocol" ,
9
6
]
10
7
11
- import sys
12
8
from typing import (
13
9
Any ,
14
- Literal ,
15
- Union ,
16
- TYPE_CHECKING ,
17
10
TypeVar ,
18
11
Protocol ,
19
12
)
20
13
21
- from numpy import (
22
- ndarray ,
23
- dtype ,
24
- int8 ,
25
- int16 ,
26
- int32 ,
27
- int64 ,
28
- uint8 ,
29
- uint16 ,
30
- uint32 ,
31
- uint64 ,
32
- float32 ,
33
- float64 ,
34
- )
35
-
36
14
_T_co = TypeVar ("_T_co" , covariant = True )
37
15
38
16
class NestedSequence (Protocol [_T_co ]):
39
17
def __getitem__ (self , key : int , / ) -> _T_co | NestedSequence [_T_co ]: ...
40
18
def __len__ (self , / ) -> int : ...
41
19
42
- Device = Literal ["cpu" ]
43
- if TYPE_CHECKING or sys .version_info >= (3 , 9 ):
44
- Dtype = dtype [Union [
45
- int8 ,
46
- int16 ,
47
- int32 ,
48
- int64 ,
49
- uint8 ,
50
- uint16 ,
51
- uint32 ,
52
- uint64 ,
53
- float32 ,
54
- float64 ,
55
- ]]
56
- else :
57
- Dtype = dtype
58
-
59
20
SupportsBufferProtocol = Any
Original file line number Diff line number Diff line change
1
+ from __future__ import annotations
2
+
3
+ __all__ = [
4
+ "ndarray" ,
5
+ "Device" ,
6
+ "Dtype" ,
7
+ ]
8
+
9
+ import sys
10
+ from typing import (
11
+ Union ,
12
+ TYPE_CHECKING ,
13
+ )
14
+
15
+ from cupy import (
16
+ ndarray ,
17
+ dtype ,
18
+ int8 ,
19
+ int16 ,
20
+ int32 ,
21
+ int64 ,
22
+ uint8 ,
23
+ uint16 ,
24
+ uint32 ,
25
+ uint64 ,
26
+ float32 ,
27
+ float64 ,
28
+ )
29
+
30
+ from cupy .cuda .device import Device
31
+
32
+ if TYPE_CHECKING or sys .version_info >= (3 , 9 ):
33
+ Dtype = dtype [Union [
34
+ int8 ,
35
+ int16 ,
36
+ int32 ,
37
+ int64 ,
38
+ uint8 ,
39
+ uint16 ,
40
+ uint32 ,
41
+ uint64 ,
42
+ float32 ,
43
+ float64 ,
44
+ ]]
45
+ else :
46
+ Dtype = dtype
Original file line number Diff line number Diff line change
1
+ from __future__ import annotations
2
+
3
+ __all__ = [
4
+ "ndarray" ,
5
+ "Device" ,
6
+ "Dtype" ,
7
+ ]
8
+
9
+ import sys
10
+ from typing import (
11
+ Literal ,
12
+ Union ,
13
+ TYPE_CHECKING ,
14
+ )
15
+
16
+ from numpy import (
17
+ ndarray ,
18
+ dtype ,
19
+ int8 ,
20
+ int16 ,
21
+ int32 ,
22
+ int64 ,
23
+ uint8 ,
24
+ uint16 ,
25
+ uint32 ,
26
+ uint64 ,
27
+ float32 ,
28
+ float64 ,
29
+ )
30
+
31
+ Device = Literal ["cpu" ]
32
+ if TYPE_CHECKING or sys .version_info >= (3 , 9 ):
33
+ Dtype = dtype [Union [
34
+ int8 ,
35
+ int16 ,
36
+ int32 ,
37
+ int64 ,
38
+ uint8 ,
39
+ uint16 ,
40
+ uint32 ,
41
+ uint64 ,
42
+ float32 ,
43
+ float64 ,
44
+ ]]
45
+ else :
46
+ Dtype = dtype
You can’t perform that action at this time.
0 commit comments