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

Method __init__

TCP/resnet.py:40–65  ·  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

38 expansion: int = 1
39
40 def __init__(
41 self,
42 inplanes: int,
43 planes: int,
44 stride: int = 1,
45 downsample: Optional[nn.Module] = None,
46 groups: int = 1,
47 base_width: int = 64,
48 dilation: int = 1,
49 norm_layer: Optional[Callable[..., nn.Module]] = None
50 ) -> None:
51 super(BasicBlock, self).__init__()
52 if norm_layer is None:
53 norm_layer = nn.BatchNorm2d
54 if groups != 1 or base_width != 64:
55 raise ValueError('BasicBlock only supports groups=1 and base_width=64')
56 if dilation > 1:
57 raise NotImplementedError("Dilation > 1 not supported in BasicBlock")
58 # Both self.conv1 and self.downsample layers downsample the input when stride != 1
59 self.conv1 = conv3x3(inplanes, planes, stride)
60 self.bn1 = norm_layer(planes)
61 self.relu = nn.ReLU(inplace=True)
62 self.conv2 = conv3x3(planes, planes)
63 self.bn2 = norm_layer(planes)
64 self.downsample = downsample
65 self.stride = stride
66
67 def forward(self, x: Tensor) -> Tensor:
68 identity = x

Callers

nothing calls this directly

Calls 2

conv3x3Function · 0.85
__init__Method · 0.45

Tested by

no test coverage detected