IndexError: too many indices for tensor of dimension 0
screenshot-colab.research.google.com-2019.06.03-17-27-03.png1100×370 48.5 KB

I am trying to write the code to train the model and I get this error. The code is given below:
model = Classifier()
criterion = nn.NLLLoss()
optimizer = optim.Adam(model.parameters(), lr=0.003)

epochs = 30
steps = 0

train_losses, test_losses = [], []
for e in range(epochs):
    running_loss = 0
    for images, labels in trainloader:        
        optimizer.zero_grad()        
        log_ps = model(images)
        loss = criterion(log_ps, labels)
        loss.backward()
        optimizer.step()        
        running_loss += loss.item()