tensorflow: MUL doesn't work on gpu delegate with error: Dimension can not be reduced to linear
System information
Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Mac OS 10.14.6 Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: iPhone XR, iPhone Xs TensorFlow installed from (source or binary): installed from source. TensorFlow version (use command below): 1.14.0 Python version: 3.6 Bazel version (if compiling from source): 1.2.1 GCC/Compiler version (if compiling from source): 4.2.1
Describe the current behavior
Mul doesn’t work with multiple axis while using gpu delegate. (no issue while using cpu).
Tried to create a dummy tflite graph with simply a multiply operation on input of shape of [1, 1, n, m] and variable with the same shape. While verifying with TFLite iOS benchmark app with GPU delegate, the benchmark app reports “failed to apply GPU delegate” on the mul operation. Note that the model runs fine without gpu delegate.
Describe the expected behavior
Mul operation works on gpu delegate and supports multiple axis.
Code to reproduce the issue Here’s the dummy model that should reproduce the issue in the TFLite ios benchmark app: dummy_model.tflite
Other info / logs
Graph: [/private/var/containers/Bundle/Application/DD8D26F4-6BC1-4EFB-A444-EA2FB7F411D9/TFLiteBenchmark.app/dummy_model_2.tflite]
Input layers: [input_feature_placeholder]
Input shapes: [1,1,2,80]
Input value ranges: []
Allow fp16 : [0]
Require full delegation : [0]
Enable op profiling: [0]
Max profiling buffer entries: [1024]
CSV File to export profiling data to: []
Use gpu : [1]
Allow lower precision in gpu : [1]
GPU delegate wait type : [aggressive]
Loaded model /private/var/containers/Bundle/Application/DD8D26F4-6BC1-4EFB-A444-EA2FB7F411D9/TFLiteBenchmark.app/dummy_model_2.tflite
2020-02-26 15:16:14.857526-0500 TFLiteBenchmark[444:628154] Initialized TensorFlow Lite runtime.
2020-02-26 15:16:14.857843-0500 TFLiteBenchmark[444:628154] Created TensorFlow Lite delegate for Metal.
2020-02-26 15:16:14.858337-0500 TFLiteBenchmark[444:628154] Metal GPU Frame Capture Enabled
2020-02-26 15:16:14.859181-0500 TFLiteBenchmark[444:628154] Metal API Validation Enabled
2020-02-26 15:16:14.932455-0500 TFLiteBenchmark[444:628154] TfLiteGpuDelegate Prepare: MUL: Dimension can not be reduced to linear.
2020-02-26 15:16:14.932670-0500 TFLiteBenchmark[444:628154] Node number 2 (TfLiteMetalDelegate) failed to prepare.
2020-02-26 15:16:14.932800-0500 TFLiteBenchmark[444:628154] tensorflow/lite/kernels/mul.cc:74 input1->type != input2->type (1 != 10)
2020-02-26 15:16:14.932891-0500 TFLiteBenchmark[444:628154] Node number 1 (MUL) failed to prepare.
Failed to apply GPU delegate.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 27 (15 by maintainers)
@uchihaltachi for whatever reason,
MULis expecting the input tensor to be a linear tensor. maybe insert aRESHAPEto match the other dimension? In GPU,1x1088x1x1is not the same as1x1x1x1088; each dimension has to match.@Richard-Yang-Bose in the log you pasted, there is
2020-02-26 15:16:14.932800-0500 TFLiteBenchmark[444:628154] tensorflow/lite/kernels/mul.cc:74 input1->type != input2->type (1 != 10), the type mismatch is betweenkTfLiteFloat32 = 1andTfLiteFloat16 = 10