juliusshufan commented on a change in pull request #9793: Enable the reporting
of cross-entropy or nll loss value when training CNN network using the models
defined by example/image-classification
File path: example/image-classification/common/fit.py
@@ -117,6 +117,8 @@ def add_fit_args(parser):
help='load the model on an epoch using the
train.add_argument('--top-k', type=int, default=0,
help='report the top-k accuracy. 0 means no report.')
+ train.add_argument('--loss', type=str,
+ help='report the cross-entropy or nll-loss. ce means
cross-entropy, nll-loss means likelihood loss')
@piiswrong @cjolivier01 Thanks for all your comments, and sorry for the
Let me try to explain:
1. My purpose is to report the loss value during training, this is because
the loss value trends is helpful to monitor the convergence trend.
2. Per my understanding is, the cross-entropy loss and (negative) likelihood
loss are most common used for softmax output, and therefore I choose reporting
either cross-entropy or negative likelihood loss as long as the output layer is
The current implementation of my PR is add a string-type argument, that is
the "--loss", and the corresponding type loss will be reported accordingly.
Meanwhile, my understanding to Eric's comment is, it be better to set the
the argument as a list including all the matching loss type (['ce', 'nll-loss']
for softmax), and give the user to decide which loss value will be used.
May I know which method is acceptable? I'll then update my implementation
Thanks for your time.
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
Apache Git Services