From 8c13c28f0c23a5d8877145e02fc2aa2ff45bd66d Mon Sep 17 00:00:00 2001 From: 2017alan <17210240044@fudan.edu.cn> Date: Sat, 15 Sep 2018 17:14:55 +0800 Subject: [PATCH] add nll loss --- fastNLP/core/loss.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fastNLP/core/loss.py b/fastNLP/core/loss.py index 8d866bbf..8a0eedd7 100644 --- a/fastNLP/core/loss.py +++ b/fastNLP/core/loss.py @@ -37,5 +37,7 @@ class Loss(object): """ if loss_name == "cross_entropy": return torch.nn.CrossEntropyLoss() + elif loss_name == 'nll': + return torch.nn.NLLLoss() else: raise NotImplementedError