Hi everyone. I am doing my project for the final assignment of Zero To GANs course. I am using the Red Wine dataset, which contains 6 classes, so in my NN I used 6 as output_size and cross entropy function as loss, because I know it is good with these type of multilabel classification.

Now, when I use the prediction function:

def predict_single(input, target, model):

inputs = input.unsqueeze(0)

predictions = model(inputs)

prediction = predictions[0].detach()

print(“Input:”, input)

print(“Target:”, target)

print(“Prediction:”, prediction)

And then:

input, target = val_df[1]

prediction = predict_single(input, target, model)

I obtain this:

Input: tensor([0.8705, 0.3900, 2.1000, 0.0650, 4.1206, 3.3000, 0.5300, 0.2610])

Target: tensor([6.])

Prediction: tensor([ 3.6465, 0.2800, -0.4561, -1.6733, -0.6519, -0.1650])

But I want to know to what class are associated these logits. In the sense that I have these 3.6465, 0.2800 and so on, but I don’t know which is the prediction.

I tried with this:

prediction = F.softmax(prediction)

print(prediction)

output = model(input.unsqueeze(0))

_,pred = output.max(1)

print(pred)

But I obtained:

tensor([0.3296, 0.1361, 0.1339, 0.1324, 0.1335, 0.1346])

tensor([0])

And I don’t know what is that tensor([0])

Thank you