Open wangg opened 4 years ago
@wangg Can you share your model with us? It's seems like a bug.
@Alicture This repo has everything to reproduce the problem. model1.py, model2.py, model3.py generate the tensorflow models I mentioned above. convert.sh shows how I call the Python scripts to generate tf models, then apply the convert tool. Both model1 and model2 can be converted sucessfully, but model3 raises an error.
@Alicture
I tried to run the converted model1 and model2.
Model 1 can be converted to tmfile, but Tengine raises an error when running the model:
Tengine/core/lib/graph_executor.cpp:357 infer shape failed on node: conv2d_1/Conv2D due to input: conv2d_1/bias size is zero
It seems that specified batch size + resize somehow caused a problem.
Model 2 can be run successfully.
According to netron's visualization, when batch size is specified, the resize layer suddenly disappears after converted to tmfile.
Model1 (raises runtime error):
Model2 (runs as expected):
Tensorflow Version: 1.13.2 convert tool: compiled from the master branch of this repo
Observation: It seems that when the input batch size is specified, the conversion of ResizeNearestNeighbor only works if it's followed by a conv layer. Is this an expected behavior?
Update: When batch size is specified, the model can be converted when the resize layer is followed by a conv layer, but Tengine raises an error when running the tmfile model: Tengine/core/lib/graph_executor.cpp:357 infer shape failed on node: conv2d_1/Conv2D due to input: conv2d_1/bias size is zero
This model can be converted to tmfile sucessfully:
This model can also be converted to tmfile sucessfully:
However, removing the conv layer after resizing and making the batch size a specific number will raise an error:
error message: error on load node: add/add op: Add Create graph failed errno: 0