fix cross entropy loss send to device

This commit is contained in:
lucasdelimanogueira 2024-05-23 10:35:55 -03:00
parent 8b19ac38c9
commit e8e0060955

View file

@ -44,7 +44,7 @@ class CrossEntropyLoss(Loss):
if input.ndim == 1:
if target.numel == 1:
num_classes = input.shape[0]
target = norch.one_hot_encode(target, num_classes)
target = norch.one_hot_encode(target, num_classes).to(target.device)
logits = norch.softmax(input, dim=0)
target = target.reshape(logits.shape)