Skip to content

Instantly share code, notes, and snippets.

@J3698
Created March 24, 2021 00:25
Show Gist options
  • Save J3698/e14e35baa4f04896d87ef84294f9388b to your computer and use it in GitHub Desktop.
Save J3698/e14e35baa4f04896d87ef84294f9388b to your computer and use it in GitHub Desktop.
features_list = []
for layer in features:
features_list.append(layer)
if isinstance(layer, nn.Conv2d):
features_list.append(nn.BatchNorm2d(layer.out_channels))
del features_list[-1]
self.features = nn.Sequential(*features_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment