Skip to content
Snippets Groups Projects
Commit cf8f7764 authored by umlauf's avatar umlauf
Browse files

Update CEL

parent 93152a6d
No related branches found
No related tags found
No related merge requests found
......@@ -178,7 +178,7 @@ def cross_entropy(logits, target):
if value == 1 or value == 0: #check if non-mixed label
one_hot = torch.tensor([1-value,value], device='cuda:0') #creating one-hot vector e.g. [0. ,1.]
loss_clear_labels = -((one_hot[0] * logprobs[0][0]) + (one_hot[1] * logprobs[0][1]))
#calculation with indexing (- 1-label * )
#calculation with indexing
results = torch.cat((loss_clear_labels.view(1), results), dim=0)
else:
mixed_vec = torch.tensor([value, 1-value]) #creating on-hot mixed vec.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment