After doing what you suggested, I found the error. I was supposed to write:
outputs.append(int(np.random.choice(len(y.cpu().detach().numpy().ravel()), size=1).reshape(1)))
instead of
outputs.append(int(np.random.choice(y.cpu().detach().numpy().ravel(), size=1).reshape(1)))
note the len(), since I’m looking for class indicies.
Thank you for the help!