Add operator broadcast error
@zxros10  Please double-check the conversion command or configuration file for options to control tensor layout preservation. Could you try to consider different conversion tools with NCHW support?
In order to expedite the trouble-shooting process, please provide a code snippet to reproduce the issue reported here. Thank you!
 This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62698">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62698">No</a>

### 1. System information

tensorflow 2.15

### 2. Code



#### Option A: Reference colab notebooks

When I convert onnx to tflite:

INFO: 19 / 25
INFO: onnx_op_type: Add onnx_op_name: Add_13
INFO:  input_name.1: 20 shape: [384, 4, 144, 144] dtype: float32
INFO:  input_name.2: 21 shape: [1, 4, 144, 144] dtype: float32
INFO:  output_name.1: 22 shape: [384, 4, 144, 144] dtype: float32
ERROR: The trace log is below.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/onnx2tf/utils/common_functions.py", line 309, in print_wrapper_func
    result = func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/onnx2tf/utils/common_functions.py", line 382, in inverted_operation_enable_disable_wrapper_func
    result = func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/onnx2tf/utils/common_functions.py", line 52, in get_replacement_parameter_wrapper_func
    func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/onnx2tf/ops/Add.py", line 187, in make_node
    correction_process_for_accuracy_errors(
  File "/usr/local/lib/python3.10/dist-packages/onnx2tf/utils/common_functions.py", line 5764, in correction_process_for_accuracy_errors
    dummy_op = tf_func(
  File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/ops/weak_tensor_ops.py", line 142, in wrapper
    return op(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/usr/local/lib/python3.10/dist-packages/keras/src/layers/core/tf_op_layer.py", line 119, in handle
    return TFOpLambda(op)(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler
    raise e.with_traceback(filtered_tb) from None
ValueError: Exception encountered when calling layer "tf.math.add" (type TFOpLambda).

Dimensions must be equal, but are 4 and 144 for '{{node tf.math.add/Add}} = AddV2[T=DT_FLOAT](Placeholder, tf.math.add/Add/y)' with input shapes: [384,4,144,144], [1,144,144,4].

Call arguments received by layer "tf.math.add" (type TFOpLambda):
  • x=tf.Tensor(shape=(384, 4, 144, 144), dtype=float32)
  • y=tf.Tensor(shape=(1, 144, 144, 4), dtype=float32)

In onnx model, the add node's two input tensor shape is [384, 4, 144, 144] and  [1, 4, 144, 144] . I think the second one can broadcast to [384, 4, 144, 144]. But the tflite convert the second to NHWC, and keep the first NCHW. Is this a bug ?