warp.from_numpy#

warp.from_numpy(
arr,
dtype=None,
shape=None,
device=None,
requires_grad=False,
)[source]#

Returns a Warp array created from a NumPy array.

Parameters:
  • arr (ndarray) – The NumPy array providing the data to construct the Warp array.

  • dtype (type | None) – The data type of the new Warp array. If this is not provided, the data type will be inferred.

  • shape (Sequence[int] | None) – The shape of the Warp array.

  • device (Device | str | None) – The device on which the Warp array will be constructed.

  • requires_grad (bool) – Whether gradients will be tracked for this array.

Raises:

RuntimeError – The data type of the NumPy array is not supported.

Return type:

array