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



107
108
109
# File 'lib/dnn/core/callbacks.rb', line 107

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