Skip to contents

Switches important flags for training and evaluation modes.

Usage

luz_callback_train_valid()

Value

A luz_callback

Details

It takes care of the three ctx attributes:

  • ctx$model: Responsible for calling ctx$model$train() and ctx$model$eval(), when appropriate.

  • ctx$training: Sets this flag to TRUE when training and FALSE when in validation mode.

  • ctx$loss: Resets the loss attribute to list() when finished training/ or validating.

Note

In general you won't need to explicitly use the train_valid callback as it's used by default in fit.luz_module_generator().