in pycls/models/efficientnet.py [0:0]
def forward(self, x):
f_x = x
# Expansion
if self.expand:
f_x = self.expand_swish(self.expand_bn(self.expand(f_x)))
# Depthwise
f_x = self.dwise_swish(self.dwise_bn(self.dwise(f_x)))
# SE
if cfg.EFFICIENT_NET.SE_ENABLED:
f_x = self.se(f_x)
# Linear projection
f_x = self.lin_proj_bn(self.lin_proj(f_x))
# Nonlinear projection
if not cfg.EFFICIENT_NET.LIN_PROJ:
f_x = self.lin_proj_swish(f_x)
# Skip connection
if self.has_skip:
# Drop connect
if self.training and cfg.EFFICIENT_NET.DC_RATIO > 0.0:
if cfg.EFFICIENT_NET.DC_IMP == 'tf':
f_x = drop_connect_tf(f_x, cfg.EFFICIENT_NET.DC_RATIO)
else:
f_x = drop_connect_pt(f_x, cfg.EFFICIENT_NET.DC_RATIO)
f_x = x + f_x
return f_x