bootstrap.Model

class bootstrap.models.model.Model(engine=None, cuda_tf=<class 'bootstrap.datasets.transforms.ToCuda'>, detach_tf=<class 'bootstrap.datasets.transforms.ToDetach'>, network=None, criterions={}, metrics={})[source]

Model contains a network, two criterions (train, eval) and two metrics.

cpu()[source]

Moves all model parameters and buffers to the CPU.

cuda(device_id=None)[source]

Moves all model parameters and buffers to the GPU.

Parameters:device_id (int, optional) – if specified, all parameters will be copied to that device
eval()[source]

Activate evaluation mode

forward(batch)[source]

Prepare the batch and feed it to the network, criterion and metric.

Returns:a dictionary of outputs
Return type:out (dict)
load_state_dict(state, *args, **kwgs)[source]
prepare_batch(batch)[source]

Prepare a batch with two functions: cuda_tf and detach_tf (only in eval mode)

state_dict(*args, **kwgs)[source]
train()[source]

Activate training mode

class bootstrap.models.model.DefaultModel(engine=None, cuda_tf=<class 'bootstrap.datasets.transforms.ToCuda'>, detach_tf=<class 'bootstrap.datasets.transforms.ToDetach'>)[source]

An extension of Model that relies on factory calls

class bootstrap.models.model.SimpleModel(engine=None, cuda_tf=<class 'bootstrap.datasets.transforms.ToCuda'>, detach_tf=<class 'bootstrap.datasets.transforms.ToDetach'>)[source]

An extension of DefaultModel that modifies the forward function

forward(batch)[source]

The forward call to the network uses batch[‘data’] instead of batch