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

change value_r CEL

parent e16fa7bc
No related branches found
No related tags found
No related merge requests found
...@@ -165,8 +165,7 @@ def cross_entropy(logits, target): ...@@ -165,8 +165,7 @@ def cross_entropy(logits, target):
#calculation with indexing (- 1-label * ) #calculation with indexing (- 1-label * )
results = torch.cat((loss_clear_labels.view(1), results), dim=0) results = torch.cat((loss_clear_labels.view(1), results), dim=0)
else: else:
value_r = round(value, 1) #to make it equal to lambda_value e.g. 0.4 mixed_vec = torch.tensor([value, 1-value]) #creating on-hot mixed vec.
mixed_vec = torch.tensor([value_r, 1-value_r]) #creating on-hot mixed vec.
logprobs = torch.nn.functional.log_softmax(lg, dim=1)#logits in log probabilities logprobs = torch.nn.functional.log_softmax(lg, dim=1)#logits in log probabilities
loss_mixed_labels = -((mixed_vec[0] * logprobs[0][0]) + (mixed_vec[1] * logprobs[0][1])) loss_mixed_labels = -((mixed_vec[0] * logprobs[0][0]) + (mixed_vec[1] * logprobs[0][1]))
#calculation for mixed with indexing #calculation for mixed with indexing
......
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