Multi-Layers Layers#
Classes#
- class Concatenate(net_check, layer, shapes, check_shapes, *, checkpoint=False, dim=0, **kwargs)[source]#
Bases:
BaseMultiLayerConstructs a concatenation layer to combine the outputs from two layers.
- Attributes:
- Parameters:
- net_checkbool
If layer index should be relative to checkpoint layers
- layer
int|list[int] Layer index(es) to concatenate the previous layer output with
- shapes
Shapes Shape of the outputs from each layer
- check_shapes
Shapes Shape of the outputs from each checkpoint
- checkpointbool,
Optional If layer index should be relative to checkpoint layers or network layers, if checkpoints in net is True, layer will always be relative to checkpoints, default = False
- dim
int,Optional Dimension to concatenate to, default = 0
- **kwargs
Leftover parameters to pass to base layer for checking
- extra_repr()[source]#
Displays layer parameters when printing the network.
- Returns:
strLayer parameters
- forward(x, *_, outputs, checkpoints, **__)[source]#
Forward pass of the concatenation layer.
- Parameters:
- x
Tensor Input tensor of shape (N,…) and type float, where N is the batch size
- outputs
list[TensorListLike] Output from each layer with tensors of shape (N,…) and type float
- checkpoints
list[TensorListLike] Output from each checkpoint with tensors of shape (N,…) and type float
- x
- Returns:
TensorOutput tensor of shape (N,…) and type float
- class Pack(net_check, shapes, check_shapes, *, checkpoint=False, layer=None, **kwargs)[source]#
Bases:
BaseMultiLayerConstructs a packing layer to combine the output from the previous layer with the output from a specified layer into a DataList.
- Attributes:
- Parameters:
- net_checkbool
If layer index should be relative to checkpoint layers
- shapes
Shapes Shape of the outputs from each layer
- check_shapes
Shapes Shape of the outputs from each checkpoint
- checkpointbool,
Optional If layer index should be relative to checkpoint layers, default = False
- layer
int|NoneType,Optional Layer index to pack with the previous layer, if layer is None, then only the last layer will be packed
- **kwargs
Leftover parameters to pass to base layer for checking
- class Shortcut(net_check, layer, shapes, check_shapes, *, checkpoint=False, **kwargs)[source]#
Bases:
BaseMultiLayerConstructs a shortcut layer to add the outputs from two layers.
- Attributes:
- Parameters:
- net_checkbool
If layer index should be relative to checkpoint layers
- layer
int|list[int] Layer index(es) to add the previous layer output with
- shapes
Shapes Shape of the outputs from each layer
- check_shapes
Shapes Shape of the outputs from each checkpoint
- checkpointbool,
Optional If layer index should be relative to checkpoint layers or network layers, if checkpoints in net is True, layer will always be relative to checkpoints, default = False
- **kwargs
Leftover parameters to pass to base layer for checking
- forward(x, *_, outputs, checkpoints, **__)[source]#
Forward pass of the shortcut layer.
- Parameters:
- x
Tensor Input tensor of shape (N,…) and type float, where N is the batch size
- outputs
list[TensorListLike] Output from each layer with tensors of shape (N,…) and type float
- checkpoints
list[TensorListLike] Output from each checkpoint with tensors of shape (N,…) and type float
- x
- Returns:
TensorOutput tensor of shape (N,…) and type float
- class Skip(net_check, layer, shapes, check_shapes, *, checkpoint=False, **kwargs)[source]#
Bases:
BaseMultiLayerBypasses previous layers by retrieving the output from the defined layer.
- Attributes:
- Parameters:
- net_checkbool
If layer index should be relative to checkpoint layers
- layer
int Layer index to get the output from
- shapes
Shapes Shape of the outputs from each layer
- check_shapes
Shapes Shape of the outputs from each checkpoint
- checkpointbool,
Optional If layer index should be relative to checkpoint layers or network layers, if checkpoints in net is True, layer will always be relative to checkpoints, default = False
- **kwargs
Leftover parameters to pass to base layer for checking
- forward(*_, outputs, checkpoints, **__)[source]#
Forward pass of the skip layer.
- Parameters:
- outputs
list[TensorListLike] Output from each layer with tensors of shape (N,…) and type float
- checkpoints
list[TensorListLike] Output from each checkpoint with tensors of shape (N,…) and type float
- outputs
- Returns:
TensorListLikeOutput with tensors of shape (N,…) and type float
- class Unpack(net_check, index, shapes, check_shapes, *, checkpoint=False, layer=None, **kwargs)[source]#
Bases:
BaseLayerEnables a list of Tensors as input into the network, then selects which Tensor in the list to output.
- Parameters:
- net_checkbool
If layer index should be relative to checkpoint layers
- index
int Index of input Tensor list
- shapes
Shapes Shape of the outputs from each layer
- check_shapes
Shapes Shape of the outputs from each checkpoint
- checkpointbool,
Optional If layer index should be relative to checkpoint layers or network layers, if checkpoints in net is True, layer will always be relative to checkpoints, default = False
- layer
int|NoneType,Optional Layer index to get the output from if checkpoint is True, default = None
- **kwargs
Leftover parameters to pass to base layer for checking
- extra_repr()[source]#
Displays layer parameters when printing the network
- Returns:
strLayer parameters
- forward(x, *_, outputs, checkpoints, **__)[source]#
Forward pass of the unpack layer.
- Parameters:
- outputs
list[TensorListLike] Output from each layer with tensors of shape (N,…) and type float, where N is the batch size
- checkpoints
list[TensorListLike] Output from each checkpoint with tensors of shape (N,…) and type float, where N is the batch size
- outputs
- Returns:
TensorOutput tensor with shape (N,…) and type float