I got this error and i am new to pytorch .please help.i am running the below code
class ConvolutionalNetwork(nn.Module):
def init(self):
super().init()
self.conv1 = nn.Conv2d(3,6,kernel_size=(3,3), stride=1, padding=1, bias=False)
self.conv1.weight = nn.Parameter(kn.expand(6, 3, -1, -1))
self.conv2 = nn.Conv2d(6, 16, kernel_size=(3,3), stride=1, padding=1, bias=False)
self.conv2.weight = nn.Parameter(kn.expand(16, 6, -1, -1))
self.fc1 = nn.Linear(565616, 120)
self.fc2 = nn.Linear(120, 84)
self.fc3 = nn.Linear(84, 18)
def forward(self, X):
        X = F.relu(self.conv1(X))
        X = F.max_pool2d(X, 2, 2)#max pooling de 2x2
        X = F.relu(self.conv2(X))
        X = F.max_pool2d(X, 2, 2)
        X = X.view(-1, 56*56*16)
        X = F.relu(self.fc1(X))
        X = F.relu(self.fc2(X))
        X = self.fc3(X)
        return F.log_softmax(X, dim=1)

torch.manual_seed(101)
CNNmodel = ConvolutionalNetwork()
x = torch.randn(1, 3, 224, 224,)
model = CNNmodel(x)
print(model)

Specify a path to save to
PATH = “model.pt”

Save
torch.save(model.state_dict(), PATH)

Load
device = torch.device(‘cpu’)
model = CNNmodel()
model.load_state_dict(torch.load(PATH, map_location=device))