split_yuv

Tensor.split_yuv()

Splits a YUV-formatted tensor into separate Y and UV tensors without additional memory allocation.

This function extracts the Y (luminance) and UV (chrominance) components from a YUV tensor formatted as YUV420SP, YUV422SP, or YUV444SP. The resulting Y and UV tensors are stored as non-image format tensors and share the same underlying memory buffer as the original YUV tensor, avoiding additional memory allocation.

Returns:

Tuple -- A tuple containing two tensors:

  • The first tensor represents the Y component.

  • The second tensor represents the UV component.

Both tensors share the underlying data with the original YUV tensor, meaning they point to the same memory locations as the corresponding Y and UV components in the original tensor.

Return type:

Tensor, Tensor

Raises:

RuntimeError -- If the YUV tensor splitting operation fails.