Hello,
There has been a recent change on the MLIR Tosa dialect that adds some extra verifications on the arguments shapes for Conv2D. After the update we noticed failures on some pretty standard networks.
The conditions as written in specification are:
ERROR_IF(OH != idiv_check(IH - 1 + pad_top + pad_bottom - (KH - 1) * dilation_y, stride_y) + 1);
ERROR_IF(OW != idiv_check(IW - 1 + pad_left + pad_right - (KW - 1) * dilation_x, stride_x) + 1);
The problem seems to be the idiv_check
which by definition fails if a % b != 0
Example from a resnet50 model:
- input 1x224x224x3
- kernel_shape: 64x7x7x3
- padding [3,3,3,3]
- dilation [1, 1]
- stride [2, 2]
- output 1x112x112x64
Calculating the condition we get idiv_check(223, 2)
which fails.
loc(""): error: 'tosa.conv2d' op expected input_height - 1 + pad_top + pad_bottom - (kernel_height - 1) * dilation_y to be wholly divisible by stride_y, got (224 - 1 + 3 + 3 - (7 - 1) * 1) / 2
loc(""): error: 'tosa.conv2d' op expected input_height - 1 + pad_top + pad_bottom - (kernel_height - 1) * dilation_y to be wholly divisible by stride_y, got (224 - 1 + 3 + 3 - (7 - 1) * 1) / 2
We were wondering that maybe idiv_check
was mistakingly used instead of a simple floor(idiv
).
Thank you