Error message during optimization stage

Hi there,

I’ve been trying to compile an ONNX model (models/validated/vision/super_resolution/sub_pixel_cnn_2016/model/super-resolution-10.onnx at main · onnx/models · GitHub) for Hailo-8 with v3.28.0. The model is a simple CNN with input shape [1, 224, 224] according to netron.

However, during optimization I was confronted with error messages:

...
TypeError: 'TensorSpec' object is not subscriptable

and I had a hard time to understand the reason for it. After a long debugging session I figured that the input shape was actually changed to [224, 224, 1] during the parsing stage and the error came due to a mismatch of shape of the data generator.

A decent error message (shape check?) would have been helpful here. You may consider that for future versions of the dataflow compiler.

Regards,
André

@andre,
The our SW works with 4-D tensors, please use (1,1,224,224)

My point is the change of shape without notice.

The onnx model uses:

>>> onnxruntime.InferenceSession(model_filename).get_inputs()[0].shape
['batch_size', 1, 224, 224]

after parsing:

>>> ClientRunner(har=f'./{model_name}.har').get_hn()['layers']['super-resolution-10/input_layer1']['input_shapes'][0]
[-1, 224, 224, 1]

It took me some time to become aware of this as there are just fuzzy error messages from framework internals being raised that I didn’t find helpful. Do with this note whatever suits you.

Regards,
André

Hi @andre.koehler, your point is valid there are two approaches for the Tensor representation NHWC (N=batch, Height, Width, Channels) and NCHW. We use the first, while ONNX uses the first, so there is need for this switch.