check_param_state_dict_cuda.py

Run a dummy model to show that model parameters can be saved and loaded from the state_dict This is useful for resuming training, loading specific epochs for evaluation, or loading pretrained models.

class Dock2D.Tests.check_param_state_dict_cuda.DummyModel(send_init_to_cuda=False)

Dummy model that trains, saves, and loads a single layer Conv2d net. Purpose was from SE(2) model always deleting a buffer of continuous filters between calls of model.train() and model.eval().

__init__(send_init_to_cuda=False)

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(x)
Parameters

x – input into conv net

Returns

simple activation

static load_checkpoint(checkpoint_fpath, model, optimizer)
Parameters
  • checkpoint_fpath – path ot checkpoint dict file

  • model – current model

  • optimizer – current optimizer

Returns

loaded state dicts for both model and optimizer

static save_checkpoint(state, filename)
Parameters
  • state – model.state_dict()

  • filename – file to save as

Returns