Skip to content
Snippets Groups Projects
Commit d7a0226f authored by kulcsar's avatar kulcsar
Browse files
parents 8244dce3 0dbfd3ef
No related branches found
No related tags found
No related merge requests found
......@@ -186,7 +186,7 @@ def cross_entropy(logits, target, l):
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([l, 1-l]) #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