ValueError: Dimensions must be equal, but are 32 and 33 for '{{node Add_135}} = Add[T=DT_FLOAT](Relu_132, BatchNormalization_134/add_1)' with input shapes: [1,128,32,32], [1,128,33,33].
Stack trace
Traceback (most recent call last):
File "/home/shreyas/.local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 1654, in _create_c_op
c_op = pywrap_tf_session.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimensions must be equal, but are 32 and 33 for '{{node Add_135}} = Add[T=DT_FLOAT](Relu_132, BatchNormalization_134/add_1)' with input shapes: [1,128,32,32], [1,128,33,33].
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "example/onnx_to_tf.py", line 6, in
tf_rep = prepare(onnx_model) # prepare tf representation
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/backend.py", line 66, in prepare
return cls.onnx_model_to_tensorflow_rep(model, strict)
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/backend.py", line 86, in onnx_model_to_tensorflow_rep
return cls._onnx_graph_to_tensorflow_rep(model.graph, opset_import, strict)
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/backend.py", line 143, in _onnx_graph_to_tensorflow_rep
output_ops = cls._onnx_node_to_tensorflow_op(onnx_node,
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/backend.py", line 249, in _onnx_node_to_tensorflow_op
return handler.handle(node, tensor_dict=tensor_dict, strict=strict)
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/handlers/handler.py", line 60, in handle
return ver_handle(node, kwargs)
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/handlers/backend/add.py", line 23, in version_7
return [cls.make_tensor_from_onnx_node(node, kwargs)]
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/handlers/backend_handler.py", line 111, in make_tensor_from_onnx_node
return cls._run_tf_func(tf_func, inputs, attrs)
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/handlers/backend_handler.py", line 181, in _run_tf_func
return tf_func(*inputs,
File "/home/shreyas/.local/lib/python3.8/site-packages/tensorflow/python/ops/gen_mathops.py", line 346, in add
, _, _op, _outputs = _op_def_library._apply_op_helper(
File "/home/shreyas/.local/lib/python3.8/site-packages/tensorflow/python/framework/op_def_library.py", line 742, in _apply_op_helper
op = g._create_op_internal(op_type_name, inputs, dtypes=None,
File "/home/shreyas/.local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 3319, in _create_op_internal
ret = Operation(
File "/home/shreyas/.local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 1816, in init
self._c_op = _create_c_op(self._graph, node_def, inputs,
File "/home/shreyas/.local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 1657, in _create_c_op
raise ValueError(str(e))
ValueError: Dimensions must be equal, but are 32 and 33 for '{{node Add_135}} = Add[T=DT_FLOAT](Relu_132, BatchNormalization_134/add_1)' with input shapes: [1,128,32,32], [1,128,33,33].
Code to replicate issue
import onnx
from onnx_tf.backend import prepare
onnx_model = onnx.load("../margipose/pretrained/margipose2.onnx") # load onnx model
tf_rep = prepare(onnx_model) # prepare tf representation
tf_rep.export_graph("output_path") # export the model
ValueError: Dimensions must be equal, but are 32 and 33 for '{{node Add_135}} = Add[T=DT_FLOAT](Relu_132, BatchNormalization_134/add_1)' with input shapes: [1,128,32,32], [1,128,33,33].
Stack trace
Traceback (most recent call last): File "/home/shreyas/.local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 1654, in _create_c_op c_op = pywrap_tf_session.TF_FinishOperation(op_desc) tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimensions must be equal, but are 32 and 33 for '{{node Add_135}} = Add[T=DT_FLOAT](Relu_132, BatchNormalization_134/add_1)' with input shapes: [1,128,32,32], [1,128,33,33].
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "example/onnx_to_tf.py", line 6, in
tf_rep = prepare(onnx_model) # prepare tf representation
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/backend.py", line 66, in prepare
return cls.onnx_model_to_tensorflow_rep(model, strict)
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/backend.py", line 86, in onnx_model_to_tensorflow_rep
return cls._onnx_graph_to_tensorflow_rep(model.graph, opset_import, strict)
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/backend.py", line 143, in _onnx_graph_to_tensorflow_rep
output_ops = cls._onnx_node_to_tensorflow_op(onnx_node,
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/backend.py", line 249, in _onnx_node_to_tensorflow_op
return handler.handle(node, tensor_dict=tensor_dict, strict=strict)
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/handlers/handler.py", line 60, in handle
return ver_handle(node, kwargs)
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/handlers/backend/add.py", line 23, in version_7
return [cls.make_tensor_from_onnx_node(node, kwargs)]
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/handlers/backend_handler.py", line 111, in make_tensor_from_onnx_node
return cls._run_tf_func(tf_func, inputs, attrs)
File "/home/shreyas/onnx/onnx-tensorflow/onnx_tf/handlers/backend_handler.py", line 181, in _run_tf_func
return tf_func(*inputs,
File "/home/shreyas/.local/lib/python3.8/site-packages/tensorflow/python/ops/gen_mathops.py", line 346, in add
, _, _op, _outputs = _op_def_library._apply_op_helper(
File "/home/shreyas/.local/lib/python3.8/site-packages/tensorflow/python/framework/op_def_library.py", line 742, in _apply_op_helper
op = g._create_op_internal(op_type_name, inputs, dtypes=None,
File "/home/shreyas/.local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 3319, in _create_op_internal
ret = Operation(
File "/home/shreyas/.local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 1816, in init
self._c_op = _create_c_op(self._graph, node_def, inputs,
File "/home/shreyas/.local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 1657, in _create_c_op
raise ValueError(str(e))
ValueError: Dimensions must be equal, but are 32 and 33 for '{{node Add_135}} = Add[T=DT_FLOAT](Relu_132, BatchNormalization_134/add_1)' with input shapes: [1,128,32,32], [1,128,33,33].
Code to replicate issue