toDLPack#

Fully qualified name: isaacsim::common::array::toDLPack

DLTensor isaacsim::common::array::toDLPack(const Array &array)#

Creates a borrowed DLPack tensor view of an Array without copying its data.

The returned tensor aliases array and points into its shape metadata. It remains valid only while array is alive and is neither moved from nor assigned. The strides pointer is null to denote the Array’s C-contiguous layout.

This function does not perform stream synchronization.

Parameters:

array – [in] Array to view.

Throws:
  • std::invalid_argument – if the Array has invalid shape metadata.

  • std::overflow_error – if the Array rank or element count cannot be represented by DLPack.

Returns:

A DLPack tensor that aliases the Array’s data and metadata.