taichi.lang.quant_impl

Module Contents

Classes

Quant

Generator of quantized types.

Attributes

quant

class taichi.lang.quant_impl.Quant

Generator of quantized types.

For more details, read https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf.

static int(bits, signed=False, 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

static fixed(frac, signed=True, num_range=1.0, compute=None)

Generates a quantized type for fixed-point real numbers.

Parameters
  • frac (int) – Number of bits.

  • signed (bool) – Signed or unsigned.

  • num_range (float) – Range of the number.

  • compute (DataType) – Type for computation.

Returns

The specified type.

Return type

DataType

static 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.lang.quant_impl.quant