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

cel

parent 924b1699
No related branches found
No related tags found
No related merge requests found
......@@ -139,7 +139,7 @@ def train(model, name, seed,gradient_accumulation_steps,mixup, threshold, lambda
return evaluation_test, evaluation_train
#-L(y, y') = -1/N * ∑( ∑(y'i * log(softmax(logits_i))) )
def cross_entropy(logits, target):
log_q = torch.log_softmax(logits, dim=1)
return -torch.sum(log_q[range(log_q.shape[0]), target])
......
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