MCPcopy Create free account
hub / github.com/HobbitLong/PyContrast / forward

Method forward

pycontrast/networks/resnet_cmc.py:154–173  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

152 return nn.Sequential(*layers)
153
154 def forward(self, x):
155 x1, x2 = torch.split(x, [1, 2], dim=1)
156 x1 = self.conv1_v1(x1)
157 x2 = self.conv1_v2(x2)
158 x = torch.cat([x1, x2], dim=1)
159 x = self.bn1(x)
160 x = self.relu(x)
161 x = self.maxpool(x)
162
163 x = self.layer1(x)
164 x = self.layer2(x)
165 x = self.layer3(x)
166 x = self.layer4(x)
167 x = self.avgpool(x)
168 x = x.view(x.size(0), -1)
169
170 feat_dim = x.shape[1]
171 x1, x2 = torch.split(x, [feat_dim // 2, feat_dim // 2], dim=1)
172
173 return x1, x2
174
175
176def resnet18(pretrained=False, **kwargs):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected