跳转至主要内容

taichi.types.quant#

This module defines generators of quantized types. For more details, read https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf.

taichi.types.quant.fixed(bits, signed=True, max_value=1.0, compute=None, scale=None)#

Generates a quantized type for fixed-point real numbers.

Parameters:
  • bits (int) – Number of bits.

  • signed (bool) – Signed or unsigned.

  • max_value (float) – Maximum value of the number.

  • compute (DataType) – Type for computation.

  • scale (float) – Scaling factor. The argument is prioritized over range.

Returns:

The specified type.

Return type:

DataType

taichi.types.quant.float(exp, frac, signed=True, compute=None)#

Generates a quantized type for floating-point real numbers.

Parameters:
  • exp (int) – Number of exponent bits.

  • frac (int) – Number of fraction bits.

  • signed (bool) – Signed or unsigned.

  • compute (DataType) – Type for computation.

Returns:

The specified type.

Return type:

DataType

taichi.types.quant.int(bits, signed=True, compute=None)#

Generates a quantized type for integers.

Parameters:
  • bits (int) – Number of bits.

  • signed (bool) – Signed or unsigned.

  • compute (DataType) – Type for computation.

Returns:

The specified type.

Return type:

DataType