glenn-jocher pre-commit-ci[bot] commited on
Commit
750c42e
1 Parent(s): e521909

`export.py` automatic `forward_export` (#6352)

Browse files

* `export.py` automatic `forward_export`

* [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>

Files changed (2) hide show
  1. export.py +2 -1
  2. tutorial.ipynb +1 -1
export.py CHANGED
@@ -427,7 +427,8 @@ def run(data=ROOT / 'data/coco128.yaml', # 'dataset.yaml path'
427
  elif isinstance(m, Detect):
428
  m.inplace = inplace
429
  m.onnx_dynamic = dynamic
430
- # m.forward = m.forward_export # assign forward (optional)
 
431
 
432
  for _ in range(2):
433
  y = model(im) # dry runs
 
427
  elif isinstance(m, Detect):
428
  m.inplace = inplace
429
  m.onnx_dynamic = dynamic
430
+ if hasattr(m, 'forward_export'):
431
+ m.forward = m.forward_export # assign custom forward (optional)
432
 
433
  for _ in range(2):
434
  y = model(im) # dry runs
tutorial.ipynb CHANGED
@@ -1099,4 +1099,4 @@
1099
  "outputs": []
1100
  }
1101
  ]
1102
- }
 
1099
  "outputs": []
1100
  }
1101
  ]
1102
+ }