MCPcopy Create free account
hub / github.com/OpenDriveLab/TCP / __init__

Method __init__

TCP/resnet.py:95–119  ·  view source on GitHub ↗
(
        self,
        inplanes: int,
        planes: int,
        stride: int = 1,
        downsample: Optional[nn.Module] = None,
        groups: int = 1,
        base_width: int = 64,
        dilation: int = 1,
        norm_layer: Optional[Callable[..., nn.Module]] = None
    )

Source from the content-addressed store, hash-verified

93 expansion: int = 4
94
95 def __init__(
96 self,
97 inplanes: int,
98 planes: int,
99 stride: int = 1,
100 downsample: Optional[nn.Module] = None,
101 groups: int = 1,
102 base_width: int = 64,
103 dilation: int = 1,
104 norm_layer: Optional[Callable[..., nn.Module]] = None
105 ) -> None:
106 super(Bottleneck, self).__init__()
107 if norm_layer is None:
108 norm_layer = nn.BatchNorm2d
109 width = int(planes * (base_width / 64.)) * groups
110 # Both self.conv2 and self.downsample layers downsample the input when stride != 1
111 self.conv1 = conv1x1(inplanes, width)
112 self.bn1 = norm_layer(width)
113 self.conv2 = conv3x3(width, width, stride, groups, dilation)
114 self.bn2 = norm_layer(width)
115 self.conv3 = conv1x1(width, planes * self.expansion)
116 self.bn3 = norm_layer(planes * self.expansion)
117 self.relu = nn.ReLU(inplace=True)
118 self.downsample = downsample
119 self.stride = stride
120
121 def forward(self, x: Tensor) -> Tensor:
122 identity = x

Callers

nothing calls this directly

Calls 3

conv1x1Function · 0.85
conv3x3Function · 0.85
__init__Method · 0.45

Tested by

no test coverage detected