Dear ptrblck,
I did so as you suggested, and changed the code in model.py to, saved the file, closed the jupyter notebook and reopened it:
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models

from constants import IMG_SIZE, NUM_CLASSES

import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models

from constants import IMG_SIZE, NUM_CLASSES

class AlexNet(nn.Module):

    def __init__(self, num_classes=NUM_CLASSES):
        super(AlexNet, self).__init__()
        self.features = nn.Sequential(
            nn.Conv2d(3, 64, kernel_size=11, stride=4, padding=2),
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=3, stride=2),
            nn.Conv2d(64, 192, kernel_size=5, padding=2),
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=3, stride=2),
            nn.Conv2d(192, 384, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.Conv2d(384, 256, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=3, stride=2),
        )
        self.classifier = nn.Sequential(
            nn.Dropout(),
            #nn.Linear(256 * 6 * 6, 4096),
            nn.Linear(256, 4096),
            nn.ReLU(inplace=True),
            nn.Dropout(),
            nn.Linear(4096, 4096),
            nn.ReLU(inplace=True),
            nn.Linear(4096, NUM_CLASSES),
        )

    def forward(self, x):
        x = self.features(x)
        # x = x.view(x.size(0), 256 * 6 * 6)
        x = x.view(x.size(0), -1)
        x = self.classifier(x)
        return x

I now get this runtime error. I’m not sure, what’s now wrong. Can you help me?
Input has shape: torch.Size([10, 3, 64, 64])
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-4-702d467d5d33> in <module>()
     67 
     68     # train for one epoch
---> 69     train(train_loader, model, criterion, optimizer, epoch)
     70 
     71     # evaluate on validation set

<ipython-input-3-d58a1c9f986c> in train(train_loader, model, criterion, optimizer, epoch)
     24 
     25         prec1, prec5 = accuracy(output.data, target, topk=(1, 5))
---> 26         losses.update(loss.data[0], data.size(0))
     27         top1.update(prec1[0], data.size(0))
     28         top5.update(prec5[0], data.size(0))

IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
---------------------------------------------------------------------------