Resize conversion bug
BmanClark opened this issue · comments
Issue Type
Others
OS
Windows
onnx2tf version number
1.20.0
onnx version number
1.15.0
onnxruntime version number
1.16.3
onnxsim (onnx_simplifier) version number
0.4.36
tensorflow version number
2.16.1
Download URL for ONNX
emailing PINTO0309 a link
Parameter Replacement JSON
{
# none necessary
}
Description
1. Purpose: creating an Android demo, that needs tflite (but all new exciting things are in PyTorch)
2. What:
...
INFO: 350 / 350
INFO: onnx_op_type: Resize onnx_op_name: /Resize_1
INFO: input_name.1: 527 shape: ['unk__4', 'unk__5', 'unk__6', 'unk__7'] dtype: float32
INFO: input_name.2: shape: None dtype: None
INFO: input_name.3: shape: None dtype: None
INFO: input_name.4: /Concat_10_output_0 shape: [4] dtype: int64
INFO: output_name.1: 1411 shape: ['Resize1411_dim_0', 'Resize1411_dim_1', 'Resize1411_dim_2', 'Resize1411_dim_3'] dtype: float32
ERROR: The trace log is below.
Traceback (most recent call last):
File "D:\Program Files\Python311\Lib\site-packages\onnx2tf\utils\common_functions.py", line 310, in print_wrapper_func
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\Python311\Lib\site-packages\onnx2tf\utils\common_functions.py", line 383, in inverted_operation_enable_disable_wrapper_func
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\Python311\Lib\site-packages\onnx2tf\utils\common_functions.py", line 53, in get_replacement_parameter_wrapper_func
func(*args, **kwargs)
File "D:\Program Files\Python311\Lib\site-packages\onnx2tf\ops\Resize.py", line 299, in make_node
if hasattr(new_size, '_inferred_value'):
^^^^^^^^
UnboundLocalError: cannot access local variable 'new_size' where it is not associated with a value
3. How: I've adjusted the onnx several times to avoid issues with input names, Tile op and Cast op to float64 (edited in onnx-modifier). But this operator (the last one!) is necessary and it appears the issue is with an uninitialized variable in the Resize op conversion itself. Looking at the code it appears new_size is always assigned unless sizes is None... but then it gets a bit complicated.
I've also tried other various other tools. This looks the most promising, but I can try others again to get past their errors.
I've also been working with both Windows and WSL2, different python / module versions to check dependencies etc. (finding magic numpy version that works for everything etc)
4. Why: My demo needs this network, however I can get it to tflite
5. Resources should just need the onnx for this.
Thank you!