warp.from_paddle#
- warp.from_paddle(
- t,
- dtype=None,
- requires_grad=None,
- grad=None,
- return_ctype=False,
- retain_grad=False,
Convert a Paddle tensor to a Warp array without copying the data.
- Parameters:
t (paddle.Tensor) – The paddle tensor to wrap.
dtype (type | None) – 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) – 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) – The grad attached to given tensor. Defaults to None.
return_ctype (bool) – Whether to return a low-level array descriptor instead of a
warp.arrayobject (faster). The descriptor can be passed to Warp kernels.retain_grad (bool) – Whether to preserve gradients during backward instead of zeroing after read.
- Returns:
The wrapped array or array descriptor.
- Return type: