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

ce

parent ed48b672
No related branches found
No related tags found
No related merge requests found
......@@ -139,7 +139,12 @@ def train(model, name, seed,gradient_accumulation_steps,mixup, threshold, lambda
return evaluation_test, evaluation_train
#Fkt vom Meeting
def cross_entropy(logits, target):
logprobs = torch.nn.functional.log_softmax (logits, dim = 1)
return -torch.mean(torch.sum(target * logprobs, dim=1))
#kann weg
# 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