Hi, I am trying to plot the confusion metric but each time when I run a cell I am getting a different result.
Here is code:
pred_list=torch.zeros(0,dtype=torch.long, device=‘cpu’)
label_list=torch.zeros(0,dtype=torch.long, device=‘cpu’)
with torch.no_grad():
for inputs, labels in train_loader:
  inputs = inputs.to(device)

  labels = labels.to(device)

  outputs = model(inputs)

  _, preds = torch.max(outputs, 1)

 

  # Append batch prediction results

  pred_list=torch.cat([pred_list,preds.view(-1).cpu()])

  label_list=torch.cat([label_list,labels.view(-1).cpu()])

Confusion matrix
conf_matrix=confusion_matrix(label_list.numpy(), pred_list.numpy())
print(conf_matrix)
Iteration 1: 
Iteration 2: 
Due to this my classification report is also varies. Any help in this regard is appriciated.