Hello Salome!
It looks as if you might be mixing together things for multi-label
(multi-class) and single-label (multi-class) problems.



 ssalome:

I’m currently doing a multi label classification problem
…
one hot vectors


One-hot vectors are typically be used to encode the labels for
a single-label, multi-class problem.  (But you normally use integer
class labels instead of one-hot encoded labels.)


one hot vector => [1. 0. 1. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0.]


Note, this is not a one-hot vector because multiple elements have
the value 1, not just one.  (Also, as written, it has no comma
separators.)


    _, pred = torch.max(outputs.data,1)
...
    correct +=(pred==labels).sum().item()



This is how you would compute the number of correct predictions is
a single-label, multi-class problem.  Note that pred, the second
element of the tuple returned by torch.max() is argmax(), that is,
the index of the largest value (along dimension 1) in output.  This
would be a single class label for your sample, not a set of multiple
active class labels.


        inputs, labels , imgindex = data
...
        outputs = resnet(inputs)

the number of output classes to 15 in the last layer.


Could you print out the shape and type() of inputs, labels,
imgindex, and outputs?  Could you also show the code for the last
Linear layer of your model and any activations that follow it?
Best.
K. Frank