qkeras.qtools.quantized_operators.multiplier_factory

Create multiplier quantizer.

Classes

MultiplierFactory()

determine which multiplier implementation to use.

class qkeras.qtools.quantized_operators.multiplier_factory.MultiplierFactory[source]

Bases: object

determine which multiplier implementation to use.

make_multiplier(weight_quantizer, input_quantizer)[source]

Create a multiplier instance.

The type and bit width of the multiplier is deteremined from the quantizer type of both the kernel (weight) and input tensor.

The table below illustrates the rule of inferring multiplier type from the quantizer type of both the kernel (weight) and input tensor

x

qb(n) +/-,exp t(-1,0,+1) b(-1,+1) b(0,1) float32

qb(n) * << >>,- ?,- ?,- ? +/-,exp << >>,- + ?,- ^ ?,-

w t(-1,0,+1) ?,- ?,- ?,^ ?,^ ^

b(-1,+1) ?,- ^ ?,^ ^ ^ b(0,1) ? ?,- ^ ^ ^ & float32

Parameters:
  • weight_quantizer (IQuantizer) – weight quantizer type

  • input_quantizer (IQuantizer) – input quantizer type

Return type:

IMultiplier

Returns:

An IMultiplier instance.