Error plot Convolution result CNN

how I display the result of the convolution as an image?

out1 = self.cnn6(out1)
        out1 = self.batchnorm6(out1)
        out1 = self.relu(out1)        
        plt.imshow(np.transpose(out1, (1,2,0)), interpolation='nearest')

RuntimeError: Can’t call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.

Did you try to use the suggestion from the error message?
Once you fix the numpy() error, you would have to check the shape of the output, since imshow expects an image format, while your output activation would contain the additional batch dimension. In that case, you could visualize each output separately. Also, you have to make sure the channel dimension is valid for an image format (i.e. it has to be 1 or 3). If that’s not the case, you could visualize each channel separately again.