warp.from_paddle#

warp.from_paddle(
t,
dtype=None,
requires_grad=None,
grad=None,
return_ctype=False,
)[source]#

Convert a Paddle tensor to a Warp array without copying the data.

Parameters:
  • t (paddle.Tensor) – The paddle tensor to wrap.

  • dtype (warp.dtype, optional) – The target data type of the resulting Warp array. Defaults to the tensor value type mapped to a Warp array value type.

  • requires_grad (bool, optional) – Whether the resulting array should wrap the tensor’s gradient, if it exists (the grad tensor will be allocated otherwise). Defaults to the tensor’s requires_grad value.

  • grad (paddle.Tensor, optional) – The grad attached to given tensor. Defaults to None.

  • return_ctype (bool, optional) – Whether to return a low-level array descriptor instead of a wp.array object (faster). The descriptor can be passed to Warp kernels.

Returns:

The wrapped array or array descriptor.

Return type:

warp.array