Hello Salome!
It’s very hard to know what you are doing.  You post some code, and
then you post some data that might or might not be related, and the
data you post has been renamed and edited.
I’ve asked you to post some specific values.  You post things that might
or might not be related, but usually differ at least somewhat from what
I’ve asked you to post.
You don’t reflect on things I’ve tried to explain.
For example, in my first reply I noted that using:
    _, pred = torch.max(outputs.data,1)

to convert your outputs to pred is appropriate for “a single-label,
multi-class problem.”  You reiterate that yours is a multi-label problem.
But the tensor you just posted for pred looks like the result of the
torch.max() statement.  But I don’t know, because I can only guess
what code produced the pred result you just posted.



 ssalome:

(fc): Linear(in_features=512, out_features=15, bias=True)
So I’ll have to change out_features to accept shape (250, 15)?


No.
It is important to understand that you write pytorch models from the
perspective of processing a single sample.  But the pytorch framework
actually processes samples in batches.
So, for example, if you write your model to take as input a tensor of
shape [244, 244] (that is a single sample), and produce as output
a tensor of shape [15] (that are the fifteen binary class labels it
predicts for that single sample), then when you run your model, you
have to pass in a batch of samples of shape [nBatch, 244, 244],
and the model will return a batch of predicted class labels of shape
[nBatch, 15].
Note, the value of nBatch is not wired into your model.  You can pass
in a batch of 250 ([250, 244, 244]), getting out a batch of 250
([250, 15]), and then, without changing the model pass in a batch
of 1 ([1, 244, 244] --> [1, 15]).  (Also note, that if you want to apply
your model to a single sample, that sample has to be wrapped in
a batch of 1.  That is, you can’t pass in [244, 244]; you have to pass
in [1, 244, 244]).
So, to repeat, your batch size of 250 does not appear in the code for
your model.  And even though the last linear layer looks as if it outputs
a tensor of shape [15] (out_features=15), because pytorch models
always work with batches, your model will output a tensor of shape
[nBatch, 15], where nBatch is the size of the batch you passed
into your model.
Good luck.
K. Frank