Issue with GPU Delegate (Stuck on 2.3.0)

Hello everyone. I’m using in android project tensorflow for 2 years and stuck on GpuDelegate V2.3.0
After this versions(2.4.0, 2.5.0, 2.6.0, 2.7.0, 2.8.0) all versions containt some error on GpuDelegate initizialization.

Failed to apply delegate: TfLiteGpuDelegate Init: MUL: Expected a 3D tensor of shape HxWxC or a 4D tensor of shape 1xHxWxC but got 170x8

here is the link for issue, that last almost 2 years

Maybe that I’m doing something wrong, and something is possible to do with this.
i’m using trained with magenta model converted from pb to tflite

Maybe this is issue of conversion of old pb to tflite, and there is some feature how to finetune for gpu delegate.

Will be appreciate for any help or advice. Thanks

Here is Tflite Model GpuDelegateBugReproduce/model.tflite at master · OleksandrGrument/GpuDelegateBugReproduce · GitHub

Sample android project how to reproduce GitHub - OleksandrGrument/GpuDelegateBugReproduce

1 Like


Pinging @khanhlvg to shed some light on if it is possible.

1 Like

Could you try to convert the model from pb file to TFLite using the latest version of TFLiteConverter? The issue could possibly come from version mismatch between TFLiteConverter and the Interpreter you use to run the model.


I tested on all tf converter versions 2.3.0-2.8.0
I have found the solution yesterday, the issue is with tf.math.multiply(weights, var), I replaced with tf.linalg.matmul(weights ,var, transpose_a=True). Looks like something changed in gpu delegate and it can’t multiply now 2d arrays with common mul operation, like in 2.3.0 version.

1 Like