concepts.dsl.tensor_value.simple_quantize_tvalue#

simple_quantize_tvalue(value)[source]#

Quantize a value into a quantized value using the simple rules.

The simple rules are:
  1. If the value is already quantized, return the value itself.

  2. If the value has tensor_quantized_values, return the tensor_indices.

  3. If the value has intrinsically quantized dtypes, quantize the value.
    • For BOOL, quantize the value with (value > 0.5).to(torch.int64).

    • For INT64, quantize the value with value.to(torch.int64).

Parameters:

value (TensorValue) – the value to be quantized.

Returns:

the quantized value.

Return type:

TensorValue