AI Features

Calculating Loss

Calculate the loss for your LSTM model.

Chapter Goals:

  • Convert your LSTM model's outputs into logits

  • Use a padding mask to calculate the overall loss

A. Logits & loss

As mentioned in earlier chapters, the task for a language model is no different from regular multiclass classification. Therefore, the loss function will still be the regular softmax cross entropy loss. We use a final fully-connected layer to convert model outputs into logits ...

Ask