This is my code.
memref.global "private" @input : memref<1x5x5x3xi8> = dense<[[[[1,1,1], [0,0,0], [-1,-1, -1], [0,0,0], [1,1,1]],
[[1,1,1], [0,0,0], [-1,-1,-1], [0,0,0], [1,1,1]],
[[1,1,1], [0,0,0], [-1,-1,-1], [0,0,0], [1,1,1]],
[[1,1,1], [0,0,0], [-1,-1,-1], [0,0,0], [1,1,1]],
[[1,1,1], [0,0,0], [-1,-1,-1], [0,0,0], [1,1,1]]]]>
// outChannels = 2 kernelDim = 3 inChannels = 3
memref.global "private" @weight : memref<2x3x3x3xi8> = dense<[[[[1,2,1],[1,2,1],[1,2,1]],
[[1,2,1],[1,2,1],[1,2,1]],
[[1,2,1],[1,2,1],[1,2,1]]],
[[[1,2,1],[1,2,1],[1,2,1]],
[[1,2,1],[1,2,1],[1,2,1]],
[[1,2,1],[1,2,1],[1,2,1]]]]>
func.func @main() {
%mem0 = memref.get_global @input : memref<1x5x5x3xi8>
%mem1 = memref.get_global @weight : memref<2x3x3x3xi8>
%mem2 = memref.alloc() : memref<1x3x3x2xi8>
linalg.conv_2d_nchw_fchw
ins (%mem0, %mem1 : memref<1x5x5x3xi8>, memref<2x3x3x3xi8>)
outs(%mem2 : memref<1x3x3x2xi8>)
return
}
When i run opt
,it says
error: 'linalg.conv_2d_nchw_fchw' op inferred input/output operand #0 has shape's dimension #3 to be greater than or equal to 4, but found 3
At the beginning, my inChannels were 1, it sayed
error: 'linalg.conv_2d_nchw_fchw' op inferred input/output operand #0 has shape's dimension #3 to be greater than or equal to 2, but found 1
then I made the inChannels 2, it sayed
error: 'linalg.conv_2d_nchw_fchw' op inferred input/output operand #0 has shape's dimension #3 to be greater than or equal to 3, but found 2
then I made the inChannels 3, it sayed
error: 'linalg.conv_2d_nchw_fchw' op inferred input/output operand #0 has shape's dimension #3 to be greater than or equal to 4, but found 3
I don’t know what I’ve set up wrong, but if anyone can help me, I’d appreciate it.Thanks!