Skip to content

Commit

Permalink
clairfy a bit and fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
leofang committed Feb 10, 2024
1 parent 4513339 commit b855568
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/array_api_stubs/_draft/array_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,11 @@ def __dlpack__(
raise ``BufferError``.
copy: Optional[bool]
boolean indicating whether or not to copy the input. If ``True``, the
function must always copy (paerformed by the producer), potentially allowing
data movement across the library (and/or device) boundary. If ``False``,
the function must never copy. If ``None``, the function must reuse existing
memory buffer if possible and copy otherwise. Default: ``None``.
function must always copy (performed by the producer). If ``False``, the
function must never copy, and raise a ``BufferError`` in case a copy is
deemed necessary (e.g. if a cross-device data movement is requested, and
it is not possible without a copy). If ``None``, the function must reuse
the existing memory buffer if possible and copy otherwise. Default: ``None``.
When a copy happens, the ``DLPACK_FLAG_BITMASK_IS_COPIED`` flag must be set.
Expand Down
4 changes: 2 additions & 2 deletions src/array_api_stubs/_draft/creation_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ def from_dlpack(
x: object
input (array) object.
device: Optional[device]
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``.
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``.
The v2023.12 standard only mandates that a compliant library must offer a way for ``from_dlpack`` to create an array on CPU (using
a library-specifc way to represent the CPU device (``kDLCPU`` in DLPack) e.g. a ``"CPU"`` string or a ``Device("CPU")`` object).
a library-specific way to represent the CPU device (``kDLCPU`` in DLPack) e.g. a ``"CPU"`` string or a ``Device("CPU")`` object).
If the array library does not support the CPU device and needs to outsource to another (compliant) array library, it may do so
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``,
the function must raise ``ValueError``.
Expand Down

0 comments on commit b855568

Please sign in to comment.