Skip to content

Commit

Permalink
Update export.py with v3.0 Hardswish() support (#831)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Aug 25, 2020
1 parent 4d7f222 commit 4fb8cb3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion models/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import argparse

import torch
import torch.nn as nn

from models.common import Conv
from models.experimental import attempt_load
Expand All @@ -32,7 +33,7 @@
# Update model
for k, m in model.named_modules():
m._non_persistent_buffers_set = set() # pytorch 1.6.0 compatability
if isinstance(m, Conv):
if isinstance(m, Conv) and isinstance(m.act, nn.Hardswish):
m.act = Hardswish() # assign activation
# if isinstance(m, Detect):
# m.forward = m.forward_export # assign forward (optional)
Expand Down

0 comments on commit 4fb8cb3

Please sign in to comment.