From ae093e23f617db98a636b73917021c16c7db125a Mon Sep 17 00:00:00 2001 From: pinto0309 Date: Wed, 3 May 2023 00:30:30 +0900 Subject: [PATCH 1/2] Fixed to never update batch size unless the batch size dimension is an undefined dimension --- README.md | 2 +- onnx2tf/__init__.py | 2 +- onnx2tf/utils/common_functions.py | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index db81aa87..04676640 100644 --- a/README.md +++ b/README.md @@ -241,7 +241,7 @@ Video speed is adjusted approximately 50 times slower than actual speed. $ docker run --rm -it \ -v `pwd`:/workdir \ -w /workdir \ - ghcr.io/pinto0309/onnx2tf:1.9.16 + ghcr.io/pinto0309/onnx2tf:1.9.17 or diff --git a/onnx2tf/__init__.py b/onnx2tf/__init__.py index bf0b1ed7..3c74d91d 100644 --- a/onnx2tf/__init__.py +++ b/onnx2tf/__init__.py @@ -1,3 +1,3 @@ from onnx2tf.onnx2tf import convert, main -__version__ = '1.9.16' +__version__ = '1.9.17' diff --git a/onnx2tf/utils/common_functions.py b/onnx2tf/utils/common_functions.py index df0652f1..6017ce68 100644 --- a/onnx2tf/utils/common_functions.py +++ b/onnx2tf/utils/common_functions.py @@ -3504,7 +3504,8 @@ def dummy_onnx_inference( for idx, dim in enumerate(input_size): if idx == 0 and input_sizes[0][0] is not None \ and not isinstance(input_sizes[0][0], str) \ - and len(input_sizes[0]) == len(input_size): + and len(input_sizes[0]) == len(input_size) \ + and dim is None or isinstance(dim, str): # Batch size assignment for input OPs new_input_size.append(input_sizes[0][0]) elif dim is None or isinstance(dim, str): @@ -3581,7 +3582,8 @@ def dummy_tf_inference( new_input_size = [] for idx, dim in enumerate(input_size): if idx == 0 and input_sizes[0][0] is not None \ - and len(input_sizes[0]) == len(input_size): + and len(input_sizes[0]) == len(input_size) \ + and dim is None: # Batch size assignment for input OPs new_input_size.append(input_sizes[0][0]) elif dim is None: From a6fbc4b4bcbd682fb39f57f21122a2802dcf6183 Mon Sep 17 00:00:00 2001 From: pinto0309 Date: Wed, 3 May 2023 00:32:31 +0900 Subject: [PATCH 2/2] Modification of decision order --- onnx2tf/utils/common_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onnx2tf/utils/common_functions.py b/onnx2tf/utils/common_functions.py index 6017ce68..a20f30fe 100644 --- a/onnx2tf/utils/common_functions.py +++ b/onnx2tf/utils/common_functions.py @@ -3505,7 +3505,7 @@ def dummy_onnx_inference( if idx == 0 and input_sizes[0][0] is not None \ and not isinstance(input_sizes[0][0], str) \ and len(input_sizes[0]) == len(input_size) \ - and dim is None or isinstance(dim, str): + and (dim is None or isinstance(dim, str)): # Batch size assignment for input OPs new_input_size.append(input_sizes[0][0]) elif dim is None or isinstance(dim, str):