it is still not showing accuracy and loss
train_iterator = torch.utils.data.TensorDataset(x_train, y_train.reshape(-1).long())
train_data = torch.utils.data.DataLoader(train_iterator, batch_size = 16, shuffle = True)
for x, y in train_data:
break
print(x.shape, y.shape)
criterion = torch.nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(net.parameters(), lr=0.0001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False)
epochs = 3
batches = len(train_data)# number of batches in your dataset (where each batch contains 64 examples from your training data)
losses=[]
accuracy=[]
for epoch in range(epochs):
epoch_loss = 0.0
epoch_accuracy = 0.0
for features, labels in train_data:
outputs = net(features)
loss = criterion (outputs,labels)
optimizer.zero_grad()
loss.backward()
optimizer.step()
epoch_loss += loss.item() # here we are accumulating loss for each training batch.
epoch_accuracy += (outputs.argmax(1) == labels).float().mean()
losses.append(epoch_loss/batches)
accuracy.append(epoch_accuracy/batches)   
print(f'Epoch: {epoch} -> Loss: {(epoch_loss/batches):.8f}, Accuracy: {(epoch_accuracy/batches):.8f}')
# dividing epoch_loss by number of batches in our train_data to get mean epoch_loss
# and printing epoch loss round of to 8 decimals.... same for epoch_accuracy