Load an onnx model with ConvTranspose2d group > 1
A pretrained model has the following layer
nn.ConvTranspose2d(64, 64, kernel_size=2, stride=2,
padding=0, output_padding=0, groups=64, bias=False)
the model was converted to onnx.
During compilation using command:
./build/bin/model-compiler -g -model model.onnx -emit-bundle ./bundle -backend=CPU
an assertion fails:
assert(filterDims.n % group == 0 && filterDims.h == kdim.height &&
filterDims.w == kdim.width && filterDims.c == idim.c / group && "Invalid filter dims");
for my case:
idim = (1, 64, 15, 20)
filterDims = (64, 1, 2, 2)
group = 64
so filterDims.n % group != 0 and filterDims.c != idim.c / group.
The assertion is passed only with group = 1.
What wrong with the layer parameters and what the assertion checks?
glow commit: 43b5e0de684f863134d2740e1b8a76c2613d5db0
pytorch commit: b2cc9928dd413ccc7b85315b1a9ed9e01f58a6eb
CC: @vuzelac-cadence
@sheh , your input idim = (1, 64, 15, 20) suggests NCHW. Glow is NHWC. So I assume asserts gets triggered since idim.c = 20. Also, not sure if you want to use CPU/Interpreter backends, but those support group=1 only. If you can please share your model.
Hey, @vuzelac-cadence I am also getting the same error for similar inputs. Activation: [1,64,20,20] Weights=[64,1,2,2] stride=[2,2] group=64
I think the problem that you were suspecting idim.c=20 is not a problem as it is transposed by ONNXModelLoader to become [1,15,20,64] and then it is not the problem.
Error is coming from filterDims.n % group != 0 and filterDims.c != idim.c / group, as filterDims.n==1 and filterDims.c==64 in our case. Mostly this error is coming from wrong transpose of filter in ONNXModelLoader.