bitorch.models.resnet.SpecificResnet

class bitorch.models.resnet.SpecificResnet(classes: int, channels: list)[source]

Superclass for ResNet models

Methods

__init__

builds feature and output layers

forward

forwards the input tensor through the resnet modules

make_feature_layers

builds the given layers with the specified block.

make_layer

builds a layer by stacking blocks in a sequential models.

Attributes

__init__(classes: int, channels: list) None[source]

builds feature and output layers

Parameters:
  • classes (int) – number of output classes

  • channels (list) – the channels used in the net

forward(x: Tensor) Tensor[source]

forwards the input tensor through the resnet modules

Parameters:

x (torch.Tensor) – input tensor

Returns:

forwarded tensor

Return type:

torch.Tensor

make_feature_layers(block: Module, layers: list, channels: list) List[Module][source]

builds the given layers with the specified block.

Parameters:
  • block (Module) – the block of which the layer shall consist

  • layers (list) – the number of blocks each layer shall consist of

  • channels (list) – the channels

Returns:

[description]

Return type:

nn.Sequential

make_layer(block: Module, layers: int, in_channels: int, out_channels: int, stride: int) Sequential[source]

builds a layer by stacking blocks in a sequential models.

Parameters:
  • block (Module) – the block of which the layer shall consist

  • layers (int) – the number of blocks to stack

  • in_channels (int) – the input channels of this layer

  • out_channels (int) – the output channels of this layer

  • stride (int) – the stride to be used in the convolution layers

Returns:

the model containing the building blocks

Return type:

nn.Sequential