Solved by ashfaque in post #9 
              
              
                class MyConv(nn.Conv2d):
    # Assuming you don't want to change the init
    
    def forward(self, input, mask):
        
        bs = input.shape[0]
        ch = input.shape[1]
        
        cols = nd2col(input,self.kernel_size, self.dilation, 1, self.stride)
        cols_att = nd2col(mask, se…