Tensor

class nvcv.Tensor
cuda(self: nvcv.Tensor) object

Reference to the Tensor on the CUDA device.

property dtype

The data type of the Tensor.

property layout

The TensorLayout of the Tensor.

property ndim

The number of dimensions of the Tensor.

reshape(self: nvcv.Tensor, shape: tuple, layout: nvcv.TensorLayout | None = None) nvcv.Tensor

Produces a tensor pointing to the same data but with a new shape and layout.

property shape

The shape of the Tensor.

nvcv.as_tensor(*args, **kwargs)

Overloaded function.

  1. as_tensor(buffer: nvcv.ExternalBuffer, layout: Optional[nvcv.TensorLayout] = None) -> nvcv.Tensor

Wrap an existing buffer into a Tensor object with the given layout.

  1. as_tensor(image: nvcvpy::priv::Image) -> nvcv.Tensor

Wrap an existing image into a Tensor object.

nvcv.reshape(tensor: nvcv.Tensor, shape: tuple, layout: nvcv.TensorLayout | None = None) nvcv.Tensor

Produces a tensor pointing to the same data but with a new shape and layout.