Both loss functions (nn.BCEWithLogitsLoss and nn.CrossEntropyLoss) expect logits as the model output, so no activation should be used. Internally these loss functions will apply the corresponding activations functions.