The setup function is used to set important attributes and method for nn_modules to be used with Luz.

setup(module, loss = NULL, optimizer = NULL, metrics = NULL)

Arguments

module

(nn_module) The nn_module that you want set up.

loss

(function, optional) An optional function with the signature function(input, target). It's only requires if your nn_module doesn't implement a method called loss.

optimizer

(torch_optimizer, optional) A function with the signature function(parameters, ...) that is used to initialize an optimizer given the model parameters.

metrics

(list, optional) A list of metrics to be tracked during the training procedure.

Value

A luz module that can be trained with fit().

Details

It makes sure the module have all the necessary ingredients in order to be fitted.