How to use parameters from autoencoder to CNN for classification

When I try to visualize kernels using code as mentioned in thread Visualize feature map, It works only for first convolutional layer
but when I try for other layers it doesn’t, gives me below error.

For conv2 layer

# kernel dislay
kernels = model.conv2.weight.detach().clone()
kernels = kernels - kernels.min()
kernels = kernels / kernels.max()
img = make_grid(kernels)
plt.imshow(img.permute(1, 2, 0))

error as
runtimeError: The expanded size of the tensor (3) must match the existing size (64) at non-singleton dimension 0. Target sizes: [3, 3, 3]. Tensor sizes: [64, 3, 3]