forked from open-mmlab/mmrazor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support export hardsigmoid in torch<=1.8 (open-mmlab#169)
* support export hardsigmoid in torch<=1.8 * fix lint
- Loading branch information
q.yao
authored
Feb 24, 2022
1 parent
486d45e
commit e9ee21f
Showing
3 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved | ||
# Modified from: | ||
# https://github.com/pytorch/pytorch/blob/9ade03959392e5a90b74261012de1d806cab2253/torch/onnx/symbolic_opset9.py | ||
from mmdeploy.core import SYMBOLIC_REWRITER | ||
|
||
|
||
@SYMBOLIC_REWRITER.register_symbolic( | ||
'hardsigmoid', is_pytorch=True, arg_descriptors=['v']) | ||
def hardsigmoid__default(ctx, g, self): | ||
"""Support export hardsigmoid This rewrite enable export hardsigmoid in | ||
torch<=1.8.2.""" | ||
return g.op('HardSigmoid', self, alpha_f=1 / 6) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters