I’m asked to make a random prediction to evaluate my model.
I have 5 classes so the easy way would be to simply do :
pred_label = random.randint(0, 4)
However, I need the randomness to be in a tensor format since I’m doing some tensor manipulation later on it the code.
my batch size 128, so I tried:
pred_label = torch.randn(128, 1000, dtype=torch.float)
However it does not seem to work later on (and gives me an accuracy of 2%).
image, label = image.to(device), label.to(device)

          pred_label = torch.randn(128, 1000, dtype=torch.float)

          prediction_cpu = pred_label.cpu().argmax(dim=1, keepdim=True)

          ground_truths = label.view_as(prediction_cpu)

What’s the best way to predict randomly?