crumpets.torch.utils module

class crumpets.torch.utils.Normalize(*args: Any, **kwargs: Any)[source]

Bases: torch.nn.

forward(x)[source]
class crumpets.torch.utils.Unpacker(*args: Any, **kwargs: Any)[source]

Bases: torch.nn.

forward(sample, *_, **__)[source]
crumpets.torch.utils.filter_state(own_state, state_dict)[source]
crumpets.torch.utils.other_type(s)[source]
crumpets.torch.utils.resume(path, model, optimizer)[source]

Given parameters, extracts a training state, i.e. initializes a network and optimizer.

Parameters
  • path – path to a pytorch snapshot (including model and optimizer states)

  • model – a network architecture for that the extracted weights are applied to

  • optimizer – an optimizer for which the extracted optimizer parameters are applied to

Returns

the loaded snapshot

crumpets.torch.utils.save(path, iteration, model, optimizer, **kwargs)[source]
crumpets.torch.utils.try_dicts(k, *ds)[source]
crumpets.torch.utils.try_types(k, *ds)[source]