Hi Felix!



 Felix_Labelle:

I used BCE loss (with logits).
…
        self.fc = nn.Linear(in_features = 2045, out_features = self.num_classes) # How to calculate this value automatically
        self.act_func = nn.Sigmoid()
...
        output = self.act_func(self.fc(convolved_images))
        output = output.reshape(batch_size,length, self.num_classes)
...
criterion = nn.BCEWithLogitsLoss()



Because your are using BCEWithLogitsLoss (seemingly reasonable
for your use case), you should get rid of the Sigmoid after your final
Linear layer, fc.  (Sigmoid converts logits to probabilities, likely not
what you want.)
Other than that, I don’t have much intuition about your use case, or
what “NUM_IMAGES” (apparently 6) might mean conceptually.
Having said that, the shenanigans where you reshape your data
into a “pseudo-batch” of size batch_size * length, pass it through
your network, and then reshape it back to a batch of batch_size
strike me as a little odd.
Best.
K. Frank