Thanks for reply,
I got the point of unfold & desired operation through it.
It could bring desired output for me.
desired operation stride=3 conv
[ B, C, H, W ] >> [ B, C*, 3xH , 3xW ] >> [ B, C*, H , W ]
This is example of what I want in case of kernel=3, so I could quantize the weights in desired operation. After stride=3, it is just same with normal convolution.
.
However I want my function to get weights & internally do all work like padding extra like nn.conv2d does, but it is hard for me to build from start what does in nn.conv2d does exactly
So what I tried was putting my function to nn.modules.conv.py function, but it did not work also.
So , I’ve been trouble still
Is there no way to just modify nn.conv2d to serve as desired function?
…
…
…
It’s flow for simple case for stride=1, I just wrote it for in case, lack of explanations above.
for batchs in range(batch):
…for channels in range(channel):
ㄴ…for i in range(move):
ㄴㄴ…for j in range(move):
ㄴㄴㄴ…out [batchs, channels, kernel * i: kernel * i+kernel, kernel * j: kernel * j+kernel]=
ㄴㄴㄴ…torch.sum(input[batchs, :, i:i+kernel, j:j+kernel] * weigt[channels,:,:,:], dim=1)