Skip to content

Commit

Permalink
add as_sequential func
Browse files Browse the repository at this point in the history
  • Loading branch information
wmkai authored Dec 21, 2022
1 parent dfef4da commit b326220
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions model/backbone/MobileNetV3.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,10 @@ def __init__(
self.classifier = Linear(self.num_features, num_classes) if num_classes > 0 else nn.Identity()

efficientnet_init_weights(self)

def as_sequential(self):
layers = [self.conv_stem, self.bn1]
layers.extend(self.blocks)
layers.extend([self.global_pool, self.conv_head, self.act2])
layers.extend([nn.Flatten(), nn.Dropout(self.drop_rate), self.classifier])
return nn.Sequential(*layers)

0 comments on commit b326220

Please sign in to comment.