How to make quantized tflite support tf.pow function?

144 Views Asked by At

Because the original tf.pow function cannot be quatilized. So I want to adjust the implementation method of the pow function so that tflite can support the pow function.

The original method of Pow function is

Po = Pi ^ gamma

changed to

ln (Po) = gamma * ln (Pi)

so,

Po = exp ^ ( gamma * ln (Pi) )

In this way, the power function can be replaced by exp function and ln function. Because Taylor expansion only needs multiplication and addition to calculate exp function and ln function, tflite provides multiplication and addition.

I just need the range 0~1. The range of Taylor expansion of ln function (at x=1) is as follows: enter image description here

I need all ranges less than 0. So I tried the exponential function of taylor expenditure in the subsection, as follows: enter image description here

I also tried linear approximation of exponential function. enter image description here

I still can't speed up the model with both methods.

Can anyone help me?

quantized tflite support function list: https://github.com/tensorflow/tensorflow/tree/f9bdcd6d9c714fc5dde232ba3b8b0a5128a07516/tensorflow/lite/delegates/hexagon

0

There are 0 best solutions below