How does "Module" know the loss function?


I just read the module tutorial in But I cannot find where to set the loss function using the " Intermediate-level Interface" APIs.


In symbolic mode, it’s somewhat confusing in the first time, but the last SoftmaxOutput symbol adds the softmax cross entropy loss to the module (common case for classification). Here discusses how to make custom loss with mx.symbol.MakeLoss.

Generally, if you can try to use gluon API (related doc) as much as possible to have more flexibility and nicer debugging options.