ternary_multiplication

keras_mml.utils.array.ternary_multiplication.ternary_multiplication(x_quantized, w_quantized, w_scale)[source]

Applies the ternary multiplication algorithm.

Important

The current implementation of the ternary multiplication still falls back to ops.matmul in Keras, since the backend-dependent implementations seem to be slower than this baseline function. This would be changed in a future version.

Parameters:
  • x_quantized – Quantized activation values.

  • w_quantized – Quantized kernel matrix without scaling applied.

  • w_scale (float) – Scale factor for the kernel matrix.

Returns:

Multiplied matrix.