Skip to content

Commit

Permalink
Update export.py (#7301)
Browse files Browse the repository at this point in the history
* Update export.py

Simplify code.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
glenn-jocher and pre-commit-ci[bot] committed Apr 5, 2022
1 parent 741fac8 commit d257c75
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions export.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,15 +480,10 @@ def run(
im, model = im.half(), model.half() # to FP16
model.train() if train else model.eval() # training mode = no Detect() layer grid construction
for k, m in model.named_modules():
# if isinstance(m, Conv): # assign export-friendly activations
# if isinstance(m.act, nn.SiLU):
# m.act = SiLU()
if isinstance(m, Detect):
m.inplace = inplace
m.onnx_dynamic = dynamic
m.export = True
if hasattr(m, 'forward_export'):
m.forward = m.forward_export # assign custom forward (optional)

for _ in range(2):
y = model(im) # dry runs
Expand Down

0 comments on commit d257c75

Please sign in to comment.