@KaiyangZhou  Unfortunately, nn.Conv2d doesn’t work in this case. In essence, nn.Conv2d runs each window of the input through a fully connected linear layer, but my function works quite differently to this.