example.fashionMNIST.training package

Submodules

example.fashionMNIST.training.evaluation module

test(model, loader, f_loss, device)

Test a model by iterating over the loader.

Parameters:
  • model (torch.nn.Module.) – A torch.nn.Module object.

  • loader (torch.utils.data.DataLoader.) – A torch.utils.data.DataLoader.

  • f_loss (torch.nn.Module.) – The loss function, i.e. a loss Module.

  • device (torch.device.) – The device to use for computation.

Returns:

A tuple with the mean loss and mean accuracy.

Return type:

tuple of two floats.

example.fashionMNIST.training.train module

train(model, loader, f_loss, optimizer, device)

Train a model for one epoch, iterating over the loader using the f_loss to compute the loss and the optimizer to update the parameters of the model.

Parameters:
  • model (torch.nn.Module.) – A torch.nn.Module object.

  • loader (torch.utils.data.DataLoader.) – A torch.utils.data.DataLoader.

  • f_loss (torch.nn.Module.) – The loss function, i.e. a loss Module.

  • optimizer (torch.optim.) – Optimisation algorithm used for the gradient retropropagation.

  • device (torch.device.) – The device to use for computation.

Returns:

None.