MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / BasicBlock

Class BasicBlock

open_loop_training/code/encoder_decoder_framework.py:103–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101 return x * x_se.sigmoid()
102
103class BasicBlock(nn.Module):
104 def __init__(self, inplanes, act=nn.ReLU, norm=nn.BatchNorm2d):
105 super(BasicBlock, self).__init__()
106 self.conv1 = nn.Conv2d(inplanes, inplanes * 2, kernel_size=3, padding=1,)
107 self.act1 = act()
108 self.bn1 = norm(inplanes * 2)
109 self.conv2 = nn.Conv2d(inplanes*2, inplanes, kernel_size=3, padding=1,)
110 self.act2 = act()
111 self.bn2 = norm(inplanes)
112 self.se = SEModule(inplanes, act)
113 def forward(self, x):
114 shortcut = x
115 x = self.conv1(x)
116 x = self.bn1(x)
117 x = self.act1(x)
118 x = self.conv2(x)
119 x = self.bn2(x)
120 x = self.se(x)
121 x += shortcut
122 x = self.act2(x)
123 return x
124
125
126

Callers 2

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected