warp.to_torch#

warp.to_torch(a, requires_grad=None)[source]#

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

Parameters:
  • a (array) – The Warp array to convert.

  • requires_grad (bool | None) – Whether the resulting tensor should convert the array’s gradient, if it exists, to a grad tensor. Defaults to the array’s requires_grad value.

Returns:

The converted tensor.

Return type:

torch.Tensor