I was trying to visualize a layer of pretrained model but when I am trying to get the middle layer of model like alexnet then I am getting 2d tensor with one column but I am expecting a feature map with 3 dimensions.
To get this output I am replacing all the layer that follows the desired layer with following layer
class Identity(nn.Module):
    def __init__(self):
         super()
   def forward(self, x):
        return x