Skip to content

Commit 980999e

Browse files
committed
API: remove ndarray.base
Base is tracked via `self._tensor._base`. Use `a.get()._base is b.get()` instead of numpy's `a.base is b`.
1 parent f664001 commit 980999e

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

torch_np/_dtypes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ def __new__(self, value):
5151
#
5252
return _ndarray.ndarray(tensor)
5353

54-
5554
##### these are abstract types
5655

5756

torch_np/_helpers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def result_or_out(result_tensor, out_array=None, promote_scalar=False):
8686

8787
def array_from(tensor, base=None):
8888
from ._ndarray import ndarray
89-
9089
return ndarray(tensor)
9190

9291

torch_np/_ndarray.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def strides(self):
9393
def itemsize(self):
9494
return self.tensor.element_size()
9595

96+
9697
@property
9798
def flags(self):
9899
# Note contiguous in torch is assumed C-style
@@ -423,6 +424,7 @@ def array(obj, dtype=None, *, copy=True, order="K", subok=False, ndmin=0, like=N
423424
if isinstance(obj, ndarray):
424425
obj = obj.tensor
425426

427+
426428
# is a specific dtype requrested?
427429
torch_dtype = None
428430
if dtype is not None:
@@ -432,6 +434,7 @@ def array(obj, dtype=None, *, copy=True, order="K", subok=False, ndmin=0, like=N
432434
return ndarray(tensor)
433435

434436

437+
435438
def asarray(a, dtype=None, order=None, *, like=None):
436439
if order is None:
437440
order = "K"

0 commit comments

Comments
 (0)