fix cross entropy loss send to device
This commit is contained in:
parent
8b19ac38c9
commit
e8e0060955
1 changed files with 1 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue