Ask questionsTFLITE Relocate Tensor Fail

<em>Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template</em>

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): Linux Ubuntu 16.04
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:No
  • TensorFlow installed from (source or binary): pip install tensorflow-gpu
  • TensorFlow version (use command below): v1.14.0-rc1-22-gaf24dc91b5 1.14.0
  • Python version: 3.5.2
  • Bazel version (if compiling from source): No
  • GCC/Compiler version (if compiling from source): No
  • CUDA/cuDNN version:
  • GPU model and memory:

You can collect some of this information using our environment capture script You can also obtain the TensorFlow version with:

  1. TF 1.0: python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
  2. TF 2.0: python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"

Describe the current behavior Steps to generate .tflite-

  1. Train a ckpt
  2. Create saved_model.pb using None,None input parameter
  3. Generate .TFLITE saved .pb model by specifying default input because None,None doesnt works

Generated .tflite Input Details. {'shape': array([ 1, 256, 256, 3], dtype=int32), 'quantization': (0.0, 0), 'dtype': <class 'numpy.float32'>, 'index': 0, 'name': 'image'} {'shape': array([ 1, 256, 256, 1], dtype=int32), 'quantization': (0.0, 0), 'dtype': <class 'numpy.float32'>, 'index': 1, 'name': 'mask'} {'shape': array([ 1, 64, 64, 1], dtype=int32), 'quantization': (0.0, 0), 'dtype': <class 'numpy.float32'>, 'index': 2, 'name': 'mask2'} {'shape': array([ 1, 128, 128, 1], dtype=int32), 'quantization': (0.0, 0), 'dtype': <class 'numpy.float32'>, 'index': 3, 'name': 'mask4'}

Actual Input Detail (1, 432, 492, 3) (1, 432, 492, 1) (1, 216, 246, 1) (1, 108, 123, 1)

Allocating Tensors based on Actual Input Values interpreter.resize_tensor_input(input_details[0]['index'], (1,h,w,3)) interpreter.resize_tensor_input(input_details[1]['index'], (1,h,w,1)) interpreter.resize_tensor_input(input_details[2]['index'], (1,int(h/4),int(w/4),1)) interpreter.resize_tensor_input(input_details[3]['index'], (1,int(h/2),int(w/2),1)) interpreter.allocate_tensors()

ERROR - File "", line 141, in <module> interpreter.allocate_tensors() File "/homelib/python3.5/site-packages/tensorflow/lite/python/", line 95, in allocate_tensors return self._interpreter.AllocateTensors() File "/home/lib/python3.5/site-packages/tensorflow/lite/python/interpreter_wrapper/", line 106, in AllocateTensors return _tensorflow_wrap_interpreter_wrapper.InterpreterWrapper_AllocateTensors(self) RuntimeError: tensorflow/lite/kernels/ d1 == d2 || d1 == 1 || d2 == 1 was not true.Node number 4 (MUL) failed to prepare.

Describe the expected behavior Allocation Should Be Done

Standalone code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem. If possible, please share a link to Colab/Jupyter/any notebook.

Other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.


Answer questions renjie-liu

Hi Karim, can you help take a look?



Related questions

ModuleNotFoundError: No module named 'tensorflow.contrib' hot 9
Tf.Keras metrics issue hot 8
Error occurred when finalizing GeneratorDataset iterator hot 7
Error loading tensorflow hot 6
module 'tensorflow' has no attribute 'ConfigProto' hot 6
TF 2.0 'Tensor' object has no attribute 'numpy' while using .numpy() although eager execution enabled by default hot 6
tensorflow-gpu CUPTI errors
Lossy conversion from float32 to uint8. Range [0, 1]. Convert image to uint8 prior to saving to suppress this warning.
ModuleNotFoundError: No module named 'tensorflow.contrib'
When importing TensorFlow, error loading Hadoop
OSError: SavedModel file does not exist at: saved_model_dir/{saved_model.pbtxt|saved_model.pb}
AttributeError: module &#39;tensorflow.python.framework.op_def_registry&#39; has no attribute &#39;register_op_list&#39;
tf.keras.layers.Conv1DTranspose ?
[TF 2.0] tf.keras.optimizers.Adam hot 4
TF2.0 AutoGraph issue hot 4
Github User Rank List