Rate this Page

QFunctional#

classtorch.ao.nn.quantized.QFunctional[source]#

Wrapper class for quantized operations.

The instance of this class can be used instead of thetorch.ops.quantized prefix. See example usage below.

Note

This class does not provide aforward hook. Instead, you must useone of the underlying functions (e.g.add).

Examples:

>>>q_add=QFunctional()>>>a=torch.quantize_per_tensor(torch.tensor(3.0),1.0,0,torch.qint32)>>>b=torch.quantize_per_tensor(torch.tensor(4.0),1.0,0,torch.qint32)>>>q_add.add(a,b)# Equivalent to ``torch.ops.quantized.add(a, b, 1.0, 0)``
Valid operation names:
  • add

  • cat

  • mul

  • add_relu

  • add_scalar

  • mul_scalar