Model can be run in tf but failed in tfjs. Error: TensorListResize input size 1 is greater maxNumElement 0.
See original GitHub issueModel can be run in tf but failed in tfjs after using tensorflowjs.converters
.
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js):
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04):ubuntu 18.04
- TensorFlow.js installed from (npm or script link): npm install @tensorflow/tfjs
- TensorFlow.js version (use command below): 3.18
- Tensorflow.js Converter Version:3.18
Repro code:
from tensorflowjs.converters import converter
import subprocess
# relative path
graph_def_path = "test_tf.pb"
tfjs_path = "test_tfjs"
input_json_path = "input.json"
output_names = "i:0,output_ta:0,output_ta2:0"
converter.convert([graph_def_path, tfjs_path, '--input_format', 'tf_frozen_model',
'--output_node_names', output_names])
# node run_tfjs.js test_tfjs/model.json input.json output.json
command = ['node', 'run_tfjs.js', tfjs_path + '/model.json', input_json_path, 'output.json']
result = subprocess.run(command)
'''
Get error ----- Error: TensorListResize input size 1 is greater maxNumElement 0.
'''
related model and code: test.zip
The model is basically from https://github.com/onnx/tensorflow-onnx/blob/e9b6cb4fca61c87fcdaf4e9610535910c01ea4f9/tests/test_loops.py#L229.
Describe the current behavior
Error: TensorListResize input size 1 is greater maxNumElement 0.
Describe the expected behavior Script can be run without any error.
Issue Analytics
- State:
- Created a year ago
- Comments:7
Top Results From Across the Web
TensorFlow model convert to tfjs, run typeError: Unknown op ...
Model can be run in tf but failed in tfjs after using tensorflowjs.converters. Using tensorflowjs to convert tf frozen graph to tfjs.
Read more >Importing TF model into TensorflowJS (trained in Python) fails ...
I was running into the same issue. With removing the line: keras.layers.Flatten(),. It worked for me.
Read more >Error: The shape of dict['input_tensor'] provided in model ...
If I add ----control_flow_v2=True to do the conversion, it will fail to loadGraphModel. I'm running @tensorflow/tfjs-node v 3.7.0 and I'm ...
Read more >@tensorflow/tfjs - npm
TensorFlow.js. TensorFlow.js is an open-source hardware-accelerated JavaScript library for training and deploying machine learning models.
Read more >node-red-contrib-tf-model 0.1.10
This is a Node-RED custom node which is used to load TensorFlow models and perform inference. Currently, it only supports the web-friendly JSON...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@pyu10055 Thank you, related PR has been merged , changes will be available once there is a new release. Thank you
Nice! I’m looking forward to the next release.
Thanks for the time you @pyu10055 @rthadur spent onto this.