Class: DNN::Callbacks::NaNStopping

Inherits:
Callback
  • Object
show all
Defined in:
lib/dnn/core/callbacks.rb

Overview

A callback to stop training the model if loss is NaN by after train on batch.

Instance Attribute Summary

Attributes inherited from Callback

#model

Instance Method Summary collapse

Instance Method Details

#after_train_on_batchObject



99
100
101
# File 'lib/dnn/core/callbacks.rb', line 99

def after_train_on_batch
  throw :stop, "loss is NaN." if model.last_log[:train_loss].nan?
end