Multi-Layers Layers#

Classes#

class Concatenate(net_check, layer, shapes, check_shapes, *, checkpoint=False, dim=0, **kwargs)[source]#

Bases: BaseMultiLayer

Constructs a concatenation layer to combine the outputs from two layers.

Attributes:
groupint

Layer group, if 0 it will always be used, else it will only be used if its group matches the Networks

descriptionstr

Description of the layer

Parameters:
net_checkbool

If layer index should be relative to checkpoint layers

layerint | list[int]

Layer index(es) to concatenate the previous layer output with

shapesShapes

Shape of the outputs from each layer

check_shapesShapes

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

dimint, 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:
str

Layer parameters

forward(x, *_, outputs, checkpoints, **__)[source]#

Forward pass of the concatenation layer.

Parameters:
xTensor

Input tensor of shape (N,…) and type float, where N is the batch size

outputslist[TensorListLike]

Output from each layer with tensors of shape (N,…) and type float

checkpointslist[TensorListLike]

Output from each checkpoint with tensors of shape (N,…) and type float

Returns:
Tensor

Output tensor of shape (N,…) and type float

class Pack(net_check, shapes, check_shapes, *, checkpoint=False, layer=None, **kwargs)[source]#

Bases: BaseMultiLayer

Constructs a packing layer to combine the output from the previous layer with the output from a specified layer into a DataList.

Attributes:
groupint

Layer group, if 0 it will always be used, else it will only be used if its group matches the Networks

descriptionstr

Description of the layer

Parameters:
net_checkbool

If layer index should be relative to checkpoint layers

shapesShapes

Shape of the outputs from each layer

check_shapesShapes

Shape of the outputs from each checkpoint

checkpointbool, Optional

If layer index should be relative to checkpoint layers, default = False

layerint | 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: BaseMultiLayer

Constructs a shortcut layer to add the outputs from two layers.

Attributes:
groupint

Layer group, if 0 it will always be used, else it will only be used if its group matches the Networks

descriptionstr

Description of the layer

Parameters:
net_checkbool

If layer index should be relative to checkpoint layers

layerint | list[int]

Layer index(es) to add the previous layer output with

shapesShapes

Shape of the outputs from each layer

check_shapesShapes

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:
xTensor

Input tensor of shape (N,…) and type float, where N is the batch size

outputslist[TensorListLike]

Output from each layer with tensors of shape (N,…) and type float

checkpointslist[TensorListLike]

Output from each checkpoint with tensors of shape (N,…) and type float

Returns:
Tensor

Output tensor of shape (N,…) and type float

class Skip(net_check, layer, shapes, check_shapes, *, checkpoint=False, **kwargs)[source]#

Bases: BaseMultiLayer

Bypasses previous layers by retrieving the output from the defined layer.

Attributes:
groupint

Layer group, if 0 it will always be used, else it will only be used if its group matches the Networks

descriptionstr

Description of the layer

Parameters:
net_checkbool

If layer index should be relative to checkpoint layers

layerint

Layer index to get the output from

shapesShapes

Shape of the outputs from each layer

check_shapesShapes

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:
outputslist[TensorListLike]

Output from each layer with tensors of shape (N,…) and type float

checkpointslist[TensorListLike]

Output from each checkpoint with tensors of shape (N,…) and type float

Returns:
TensorListLike

Output with tensors of shape (N,…) and type float

class Unpack(net_check, index, shapes, check_shapes, *, checkpoint=False, layer=None, **kwargs)[source]#

Bases: BaseLayer

Enables 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

indexint

Index of input Tensor list

shapesShapes

Shape of the outputs from each layer

check_shapesShapes

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

layerint | 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:
str

Layer parameters

forward(x, *_, outputs, checkpoints, **__)[source]#

Forward pass of the unpack layer.

Parameters:
outputslist[TensorListLike]

Output from each layer with tensors of shape (N,…) and type float, where N is the batch size

checkpointslist[TensorListLike]

Output from each checkpoint with tensors of shape (N,…) and type float, where N is the batch size

Returns:
Tensor

Output tensor with shape (N,…) and type float