summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTirth Patel <tirthasheshpatel@gmail.com>2022-03-09 07:13:54 +0530
committerTirth Patel <tirthasheshpatel@gmail.com>2022-03-09 07:13:54 +0530
commitbaac3367e843c3779e43631a6d60cf36fb83bc1e (patch)
tree25dcde7d8a4fd4d141a389d36da560a3fc579932
parent01d6bce0009033184571d58ce506050e5216913c (diff)
downloadnumpy-baac3367e843c3779e43631a6d60cf36fb83bc1e.tar.gz
DOC: use ELLIPSIS in error message and add note about copying
Co-authored-by: Matti Picus <matti.picus@gmail.com>
-rw-r--r--doc/source/user/basics.interoperability.rst7
1 files changed, 4 insertions, 3 deletions
diff --git a/doc/source/user/basics.interoperability.rst b/doc/source/user/basics.interoperability.rst
index 025382771..ac85e79a0 100644
--- a/doc/source/user/basics.interoperability.rst
+++ b/doc/source/user/basics.interoperability.rst
@@ -456,7 +456,8 @@ The imported arrays are read-only so writing or operating in-place will fail:
File "<stdin>", line 1, in <module>
ValueError: assignment destination is read-only
-A copy must be created in order to operate on the imported arrays in-place:
+A copy must be created in order to operate on the imported arrays in-place, but
+will mean duplicating the memory. Do not do this for very large arrays:
>>> x_np_copy = x_np.copy()
>>> x_np_copy.sort() # works
@@ -487,10 +488,10 @@ Read-only arrays cannot be exported:
>>> x_np = np.arange(5)
>>> x_np.flags.writeable = False
- >>> torch.from_dlpack(x_np)
+ >>> torch.from_dlpack(x_np) # doctest: +ELLIPSIS
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
- File "/home/tirthasheshpatel/tensor_libs/virtualenvs/numpy-dev/lib/python3.9/site-packages/torch/utils/dlpack.py", line 63, in from_dlpack
+ File ".../site-packages/torch/utils/dlpack.py", line 63, in from_dlpack
dlpack = ext_tensor.__dlpack__()
TypeError: NumPy currently only supports dlpack for writeable arrays