in depth_upsampling/models/mspf/densenet.py [0:0]
def forward(self, x):
_, _, h, w = x.shape
features = [x]
skip_feat = {"x1": x}
for k, v in self.base_model._modules.items():
# ignore classification head
if 'fc' in k or 'avgpool' in k:
continue
feature = v(features[-1])
features.append(feature)
if any(x in k for x in self.skip_feature_names):
_, _, fh, fw = feature.shape
skip_feat[f"x{int(h/fh)}"] = feature
return skip_feat