Shortcuts

torch.utils.dlpack

torch.utils.dlpack.from_dlpack(dlpack) → Tensor

Decodes a DLPack to a tensor.

Parameters:dlpack – a PyCapsule object with the dltensor

The tensor will share the memory with the object represented in the dlpack. Note that each dlpack can only be consumed once.

torch.utils.dlpack.to_dlpack(tensor) → PyCapsule

Returns a DLPack representing the tensor.

Parameters:tensor – a tensor to be exported

The dlpack shares the tensors memory. Note that each dlpack can only be consumed once.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources