Mojo function
calculate_symmetric_vector
calculate_symmetric_vector[input_dtype: DType, simd_width: Int, output_bits: Int](data: SIMD[input_dtype, simd_width]) -> Tuple[SIMD[uint8, simd_width], SIMD[input_dtype, 1]]
Symmetrically quantizes the given SIMD vector data
with input type input_dtype
and simd_width
elements, assuming we want the results to fit in an unsigned integer of size output_bits
.
Parameters:
- input_dtype (
DType
): The dtype of the input tensor. - simd_width (
Int
): The width of the SIMD input. - output_bits (
Int
): The bits we want to fit the unsigned integral result in.
Args:
- data (
SIMD[input_dtype, simd_width]
): The input SIMD we want to quantize.
Returns:
A vector of the quantized values. The associated scale factor.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!