def forward(self, x: flow.Tensor) -> flow.Tensor: features = self.features(x) out = F.relu(features, inplace=True) out = F.adaptive_avg_pool2d(out, (1, 1)) out = flow.flatten(out, 1) out = self.classifier(out) return out
def forward(self, x): out = swish(self.bn1(self.conv1(x))) out = self.layers(out) out = F.adaptive_avg_pool2d(out, 1) out = out.view(out.size(0), -1) dropout_rate = self.cfg['dropout_rate'] if self.training and dropout_rate > 0: out = F.dropout(out, p=dropout_rate) out = self.linear(out) return out
def forward(self, x): out = F.relu(self.bn1(self.conv1(x))) out = self.layer1(out) out = self.layer2(out) out = self.layer3(out) out = self.layer4(out) out = F.adaptive_avg_pool2d(out, (1, 1)) out = out.view(out.size(0), -1) out = self.linear(out) return out
def forward(self, x): out = F.adaptive_avg_pool2d(x, (1, 1)) out = swish(self.se1(out)) out = self.se2(out).sigmoid() out = x * out return out