29 #ifndef LBANN_CALLBACKS_CALLBACK_HPP_INCLUDED 30 #define LBANN_CALLBACKS_CALLBACK_HPP_INCLUDED 36 #include <google/protobuf/message.h> 48 #define LBANN_ADD_DEFAULT_CALLBACK_BUILDER(Class, FunctionName) \ 49 inline std::unique_ptr<callback_base> FunctionName( \ 50 const google::protobuf::Message&, \ 51 std::shared_ptr<lbann_summary> const&) \ 53 return std::make_unique<Class>(); \ 85 : m_batch_interval(std::max(batch_interval, 1))
197 virtual std::string name()
const = 0;
207 template <
class Archive>
211 void write_proto(lbann_data::Callback& proto)
const;
215 virtual void write_specific_proto(lbann_data::Callback& proto)
const = 0;
221 std::string get_multi_trainer_path(
const model& m,
222 const std::string& root_dir);
227 std::string get_multi_trainer_ec_model_path(
const model& m,
228 const std::string& root_dir);
233 std::string get_multi_trainer_model_path(
const model& m,
234 const std::string& root_dir);
252 #endif // LBANN_CALLBACKS_CALLBACK_HPP_INCLUDED virtual void on_validation_end(model *m)
Called immediately after the end of validation.
virtual void on_evaluate_forward_prop_end(model *m, Layer *l)
Called when a layer ends forward propagation for evaluation (validation / testing).
virtual void on_forward_prop_begin(model *m, Layer *l)
Called when a layer begins forward propagation.
callback_base(int batch_interval=1)
Initialize a callback with an optional batch interval.
virtual void on_optimize_begin(model *m)
Called when a model begins optimization.
virtual void on_forward_prop_end(model *m, Layer *l)
Called when a layer ends forward propagation.
virtual void on_epoch_begin(model *m)
Called at the beginning of each epoch.
virtual void on_batch_begin(model *m)
Called at the beginning of a (mini-)batch.
virtual void on_evaluate_forward_prop_end(model *m)
Called when a model ends forward propagation for evaluation (validation / testing).
virtual void on_setup_end(model *m)
Called at the end of setup.
virtual void on_train_begin(model *m)
Called at the beginning of training.
virtual void on_backward_prop_end(model *m, Layer *l)
Called when a layer ends backward propagation.
virtual void setup(model *m)
Called once to set up the callback on the model (after all layers are set up).
virtual void on_test_begin(model *m)
Called at the beginning of testing.
virtual void on_epoch_end(model *m)
Called immediate after the end of each epoch.
virtual void on_batch_evaluate_begin(model *m)
Called at the beginning of a (mini-)batch evaluation (validation / testing).
void serialize(std::ostream &os, google::protobuf::Message const &msg)
Serialize the protobuf message to a stream.
Neural network tensor operation.
Generates nicely formatted description messages.
virtual void on_backward_prop_begin(model *m)
Called when a model begins backward propagation.
virtual void on_test_end(model *m)
Called immediately after the end of testing.
virtual void on_optimize_begin(model *m, weights *w)
Called when weights begins optimization.
virtual void setup(trainer *t)
Called once to set up the callback on the trainer.
virtual void on_batch_end(model *m)
Called immediately after the end of a (mini-)batch.
virtual void on_backward_prop_begin(model *m, Layer *l)
Called when a layer begins backward propagation.
Base class for callbacks during training/testing.
Abstract base class for neural network models.
virtual void on_evaluate_forward_prop_begin(model *m)
Called when a model begins forward propagation for evaluation (validation / testing).
virtual void on_forward_prop_end(model *m)
Called when a model ends forward propagation.
virtual void on_optimize_end(model *m, weights *w)
Called when weights ends optimization.
virtual void on_optimize_end(model *m)
Called when a model ends optimization.
virtual void on_validation_begin(model *m)
Called at the beginning of validation.
virtual void on_evaluate_forward_prop_begin(model *m, Layer *l)
Called when a layer begins forward propagation for evaluation (validation / testing).
virtual void on_backward_prop_end(model *m)
Called when a model ends backward propagation.
User-facing class that represents a set of compute resources.
virtual void on_forward_prop_begin(model *m)
Called when a model begins forward propagation.
int m_batch_interval
Batch methods should once every this many steps.
virtual void on_phase_end(model *m)
Called at the end of every phase (multiple epochs) in a layer-wise model training.
virtual void on_train_end(model *m)
Called at the end of training.
virtual void on_batch_evaluate_end(model *m)
Called at the end of a (mini-)batch evaluation (validation / testing).
int get_batch_interval() const
Return the batch interval.