How to visualize each conv2 layer in resnet50

I am trying to visualize each conv2d layer in resnet50.
I found the blog and used to create the visuals for 1st layer (

from sklearn.preprocessing import minmax_scale

def visualize_first_layer(learn):
conv1 = list(learn.model.children())[0][0]
weights =
weights_shape = weights.shape
weights = minmax_scale(weights.ravel()).reshape(weights_shape)
fig, axes = plt.subplots(8, 8, figsize=(8,8))
for i, ax in enumerate(axes.flat):
ax.imshow(np.rollaxis(weights[i], 0, 3))


But, I am not sure how to build it for other layers and I am not able to access them. I get following error:
bottleneck’ object is not subscriptable fastai