Skip to content

Commit b855568

Browse files
committed
clairfy a bit and fix typos
1 parent 4513339 commit b855568

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/array_api_stubs/_draft/array_object.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,11 @@ def __dlpack__(
355355
raise ``BufferError``.
356356
copy: Optional[bool]
357357
boolean indicating whether or not to copy the input. If ``True``, the
358-
function must always copy (paerformed by the producer), potentially allowing
359-
data movement across the library (and/or device) boundary. If ``False``,
360-
the function must never copy. If ``None``, the function must reuse existing
361-
memory buffer if possible and copy otherwise. Default: ``None``.
358+
function must always copy (performed by the producer). If ``False``, the
359+
function must never copy, and raise a ``BufferError`` in case a copy is
360+
deemed necessary (e.g. if a cross-device data movement is requested, and
361+
it is not possible without a copy). If ``None``, the function must reuse
362+
the existing memory buffer if possible and copy otherwise. Default: ``None``.
362363
363364
When a copy happens, the ``DLPACK_FLAG_BITMASK_IS_COPIED`` flag must be set.
364365

src/array_api_stubs/_draft/creation_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,10 @@ def from_dlpack(
228228
x: object
229229
input (array) object.
230230
device: Optional[device]
231-
device on which to place the created array. If ``device`` is ``None`` and ``x`` supports DLPack, the output array device must be inferred from ``x.device``. Default: ``None``.
231+
device on which to place the created array. If ``device`` is ``None`` and ``x`` supports DLPack, the output array must be on the same device as ``x``. Default: ``None``.
232232
233233
The v2023.12 standard only mandates that a compliant library must offer a way for ``from_dlpack`` to create an array on CPU (using
234-
a library-specifc way to represent the CPU device (``kDLCPU`` in DLPack) e.g. a ``"CPU"`` string or a ``Device("CPU")`` object).
234+
a library-specific way to represent the CPU device (``kDLCPU`` in DLPack) e.g. a ``"CPU"`` string or a ``Device("CPU")`` object).
235235
If the array library does not support the CPU device and needs to outsource to another (compliant) array library, it may do so
236236
with a clear user documentation and/or run-time warning. If a copy must be made to enable this, and ``copy`` is set to ``False``,
237237
the function must raise ``ValueError``.

0 commit comments

Comments
 (0)