Thank you for your reply. However, I forgot to specify that given the input of size [1, 4, 256, 256], I wanted the output size of [1, 1, 64, 64],i.e., get the max-pooling along channels as well. But after seeing your approach, I added one more dimension at index zero and then it seems to work fine. I forgot about adding the batch dimension. Thank you for your help.