I’m glad that you’ve solved the issue.
However, note that you are currently using a multi-label approach, as your model outputs 2 units and you are using sigmoid + F.binary_cross_entropy.
In other words, each sample might contain zero, one, or two valid classes.
Based on your description, it seems you are working on a binary classification, where either the class is valid or not.
If that’s the case, you should use a single output neuron and provide a target with values in the range [0, 1] and in the shape [batch_size, 1].