returnn.pretrain
¶
This module contains pretrain related code. This is independent from the backend (TF or Theano, etc).
- class returnn.pretrain.WrapEpochValue(func)[source]¶
Use this wrapper if you want to define some value in your network which depends on the pretrain epoch. This is going to be part in your network description dict.
- Parameters:
((epoch – int) -> object) func: function which should accept one kwd-arg ‘epoch’
- class returnn.pretrain.Pretrain(original_network_json, network_init_args=None, copy_param_mode=None, copy_output_layer=None, greedy=None, repetitions=None, construction_algo='from_output', output_layers=('output',), input_layers=('data',))[source]¶
Start with 1 hidden layers up to N hidden layers -> N pretrain steps -> N epochs (with repetitions == 1). The first hidden layer is the input layer. This works for generic network constructions. See _construct_epoch().
- Parameters:
network_init_args (dict[str]|None) – additional args we use for LayerNetwork.from_json(). must have n_in, n_out. (for Theano only, thus optional now)
copy_param_mode (str)
copy_output_layer (bool|str) – whether to copy the output layer params from last epoch or reinit
greedy (bool) – if True, only train output+last layer, otherwise train all
repetitions (None | int | list[int] | dict) – how often to repeat certain pretrain steps. default is one epoch. It can also be a dict, with keys like ‘default’ and ‘final’. See code below.
construction_algo (str|callable) – e.g. “from_output”
output_layers (list[str]|tuple[str]) – used for construction
input_layers (list[str]|tuple[str]) – used for construction