bitorch.models.resnet.BasicBlockV2

class bitorch.models.resnet.BasicBlockV2(in_channels: int, out_channels: int, stride: int)[source]

BasicBlock V2 from “Identity Mappings in Deep Residual Networks” paper. This is used for ResNet V2 for 18, 34 layers.

Methods

__init__

builds body and downsampling layers

forward

forwards the input tensor x through the building block.

Attributes

__init__(in_channels: int, out_channels: int, stride: int) None[source]

builds body and downsampling layers

Parameters:
  • in_channels (int) – input channels for building block

  • out_channels (int) – output channels for building block

  • stride (int) – stride to use in convolutions

forward(x: Tensor) Tensor[source]

forwards the input tensor x through the building block.

Parameters:

x (torch.Tensor) – the input tensor

Returns:

the output of this building block after adding the input tensor as residual value.

Return type:

torch.Tensor