Thank you for your reply. I found an answer that elaborates on the first method (Passing the weights to CrossEntropyLoss correctly 1). On that answer, is it enough to pass the weights list without the class labels, even when the labels are one-hot vectors?