bitorch_engine.functions.cuda.functions.unpack_uint8_tensor

bitorch_engine.functions.cuda.functions.unpack_uint8_tensor(input: Tensor, scale: Tensor) Tensor[source]

Unpacks an 8-bit unsigned integer tensor into a floating-point tensor using CUDA, scaling the unpacked values by a provided scale tensor.

This function is a Python interface to the CUDA backend that performs the unpacking and scaling operation. It is designed to work with tensors that represent compressed data in 8-bit unsigned integer format and converts them into a higher precision floating-point format. This is useful in scenarios where compact data representations need to be expanded and processed in their original or higher precision for further computations or analysis.

Parameters:
  • input (-) – A tensor of 8-bit unsigned integers with shape (batch_size, sequence_length, packed_embedding_dimension). This tensor represents the compressed embeddings or data to be unpacked.

  • scale (-) – A tensor with shape (batch_size, sequence_length, 1) that contains scaling factors for each sequence in the batch. These factors are applied to the unpacked floating-point values.

Returns:

A tensor of floating-point (-1.0, 1.0) values with shape

(batch_size, sequence_length, packed_embedding_dimension * 8), where the unpacked and scaled embeddings or data are stored.

Return type:

  • torch.Tensor

The function directly interfaces with a CUDA implementation for efficient processing on GPUs, offering significant speedups compared to CPU-based operations.