pytorch_tensor_as_opencv_gpu_mat

savant.utils.memory_repr_pytorch.pytorch_tensor_as_opencv_gpu_mat(tensor)

Returns OpenCV GpuMat for the given PyTorch tensor (zero-copy). The tensor must have 2 or 3 dims in HWC format and C-contiguous layout.

Use Tensor.size() and Tensor.is_contiguous() to check if a tensor has supported shape format and is contiguous in memory.

Use Tensor.transpose() and Tensor.contiguous() to transform a tensor if necessary (creates a copy of the tensor).