pyprobound.layers.layer.LayerSpec
- class LayerSpec(out_channels, in_channels, name='')
Bases:
Spec,LengthManagerA component that stores experiment-independent parameters of layers.
The forward implementation should be left to the Layer.
- __init__(out_channels, in_channels, name='')
Initializes the layer specification.
- Parameters:
out_channels (
int) – The number of output channels.in_channels (
int) – The number of input channels.name (
str) – A string used to describe the layer.
Methods
check_length_consistency()Checks that input lengths of Binding components are consistent.
Iterator of child components.
forward()Define the computation performed at every call.
freeze()Turns off gradient calculation for all parameters.
in_len(length[, mode])Calculates the receptive field.
max_embedding_size()The maximum number of bytes needed to encode a sequence.
optim_procedure([ancestry, current_order])The sequential optimization procedure for all Binding components.
out_len(length[, mode])Calculates the number of elements in the output length dimension.
reload(checkpoint)Loads the model from a checkpoint file.
reload_from_state_dict(state_dict)Loads the model from a state dict.
save(checkpoint[, flank_lengths])Saves the model to a file with "state_dict" and "metadata" fields.
unfreeze([parameter])Turns on gradient calculation for the specified parameter.
update_binding_optim(binding_optim)Updates a BindingOptim with the specification's optimization steps.
Attributes
The number of input channels.
The number of output channels.
unfreezablealias of
Literal['all']Non-Inherited Members
- property out_channels: int
The number of output channels.
- property in_channels: int
The number of input channels.