onnx-coreml icon indicating copy to clipboard operation
onnx-coreml copied to clipboard

Espresso exception: "Invalid blob shape": generic_elementwise_kernel: cannot broadcast [48, 64, 32, 1, 1] and [24, 32, 32, 1, 1]

Open AnasArram opened this issue 5 years ago • 3 comments

Command CoreMLModelCompile failed with a nonzero exit code

i have successfully converted the onnx model (originally in pytorch) using the following:

mlmodel = convert('NetModel.onnx', target_ios='13', custom_conversion_functions={'Upsample': _convert_upsample})

and when i tried to run this model in xcode i got the this error:

coremlc: Error: compiler error: Espresso exception: "Invalid blob shape": generic_elementwise_kernel: cannot broadcast [48, 64, 32, 1, 1] and [24, 32, 32, 1, 1] Command CoreMLModelCompile failed with a nonzero exit code

mostly this happened in upsampling conversion.

AnasArram avatar Dec 03 '19 12:12 AnasArram

@bhushan23 I have faced with the similar issue. Is there any workaround for it?

dry1lud avatar Apr 20 '20 16:04 dry1lud

@bhushan23 I have faced with the similar issue. Is there any workaround for it?

this issue is from upsample. the output shape of upsample layer is [48, 64, 32, 1, 1] and the input shape of the next layer is [24, 32, 32, 1, 1], so different shapes and they should be same. Workaround for this is you need to specify the scales for each upsample layer. you may know the upsample scale of your models by looking at the input shape of the upsample layer and the input shape of the next layer and estimate the scale.

AnasArram avatar Apr 20 '20 16:04 AnasArram

I did not specify any custom_concersion_function, but still got this error.

Just wondering any update?

franva avatar Mar 22 '22 11:03 franva