loop

Loop

class Loop(model, optimizer, loss_fn, metrics=None, callbacks=(), history=None, device='cpu')

The simplest kind of loop for basic supervised learning.

Note

If you have more custom things you’d like to to that cant be handled in callbacks it’s recommended to subclass this and overide the handle_batch method.

stages = ('train', 'val')
property optimizer
to(device)
property metrics
property loss_fn
property loss
property metric
grad_context()
optimizer_step()
compute_loss(yhat, ytru, **kwargs)
compute_metric(yhat, ytru, **kwargs)
backward(loss, **kwargs)
forward(x, **kwargs)
handle_batch(batch)
handle_batches(batches)
handle_stage(stage, batches)
fire(event)