I tired of this error. can you help me please. @ptrblck
My code
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import DataLoader

import torchvision.transforms as transforms
import torchvision.datasets as datasets
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import numpy as np
from torchvision import models
import torchvision.transforms as transforms
import cv2


class MyModel(nn.Module):
   def __init__(self):
       super(MyModel, self).__init__()
       self.mod= models.mnasnet1_0(pretrained=True)
       self.convNet= nn.Sequential(*list(self.mod.children()))

       
   def forward(self, x):

       seqLen = x.size(0) - 1
       for t in range(0, seqLen):
           x1 = x[t] - x[t+1]
           x2 = self.convNet(x1)

img1 = './dataset/11/frame001.jpg'
img2=  './dataset/11/frame004.jpg'
img1 = Image.open(str(img1))
img2 = Image.open(str(img2)) 




trans= transforms.Compose([transforms.RandomResizedCrop(224),
                                               transforms.ToTensor(),
                                               transforms.Normalize([0.485, 0.456, 0.406],[0.229, 0.224, 0.225])])


inpSeq = []
# img1=Image.fromarray(img1)
# img2=Image.fromarray(img2)

inpSeq.append(trans(img1.convert('RGB')))
inpSeq.append(trans(img2.convert('RGB')))
inpSeq = torch.stack(inpSeq, 0)

inpSeq=inpSeq.unsqueeze(0)
model = MyModel()


activation = {}
def get_activation(name):
   def hook(model, input, output):
       activation[name] = output.detach()
   return hook

model.convNet.register_forward_hook(get_activation('conv1'))

output = model(inpSeq)

act = activation['conv1'].squeeze()
plt.imshow(act[0])

error is here:
Traceback (most recent call last):

  File "C:\Users\Windows10\Desktop\Code1\exp.py", line 67, in <module>
    act = activation['conv1'].squeeze()

KeyError: 'conv1'