@@ -55,7 +55,7 @@ def __init__(self, array_like: ArrayLike) -> None:
55
55
56
56
if array_like .ndim != 1 :
57
57
raise ValueError ("array_like: only 1-dim allowed" )
58
- if array_like .dtype != np .dtype ("b " ):
58
+ if array_like .dtype != np .dtype ("B " ):
59
59
raise ValueError ("array_like: only byte dtype allowed" )
60
60
61
61
if not hasattr (array_like , "__cuda_array_interface__" ):
@@ -80,7 +80,7 @@ def create_zero_length(cls) -> Self:
80
80
-------
81
81
New empty 0-length buffer
82
82
"""
83
- return cls (cp .array ([], dtype = "b " ))
83
+ return cls (cp .array ([], dtype = "B " ))
84
84
85
85
@classmethod
86
86
def from_buffer (cls , buffer : core .Buffer ) -> Self :
@@ -96,14 +96,14 @@ def from_buffer(cls, buffer: core.Buffer) -> Self:
96
96
97
97
@classmethod
98
98
def from_bytes (cls , bytes_like : BytesLike ) -> Self :
99
- return cls .from_array_like (cp .frombuffer (bytes_like , dtype = "b " ))
99
+ return cls .from_array_like (cp .frombuffer (bytes_like , dtype = "B " ))
100
100
101
101
def as_numpy_array (self ) -> npt .NDArray [Any ]:
102
102
return cast (npt .NDArray [Any ], cp .asnumpy (self ._data ))
103
103
104
104
def __add__ (self , other : core .Buffer ) -> Self :
105
105
other_array = other .as_array_like ()
106
- assert other_array .dtype == np .dtype ("b " )
106
+ assert other_array .dtype == np .dtype ("B " )
107
107
gpu_other = Buffer (other_array )
108
108
gpu_other_array = gpu_other .as_array_like ()
109
109
return self .__class__ (
@@ -125,7 +125,7 @@ class NDBuffer(core.NDBuffer):
125
125
Notes
126
126
-----
127
127
The two buffer classes Buffer and NDBuffer are very similar. In fact, Buffer
128
- is a special case of NDBuffer where dim=1, stride=1, and dtype="b ". However,
128
+ is a special case of NDBuffer where dim=1, stride=1, and dtype="B ". However,
129
129
in order to use Python's type system to differentiate between the contiguous
130
130
Buffer and the n-dim (non-contiguous) NDBuffer, we keep the definition of the
131
131
two classes separate.
0 commit comments