Skip to content

Commit

Permalink
[vizard] support torch.sub/sign/abs in eager mode
Browse files Browse the repository at this point in the history
Summary:
X-link: facebookresearch/d2go#618

As title
Achieve by `vizard.quantization.functional. FloatFunctional` and `vizard.quantization.prepare.prepare_eager`

Test Plan:
```
[[email protected] ~/fbcode (771b07cbd)]$ buck2 test vizard/test/quantization:test_quantization
File changed: fbcode//vizard/test/quantization/TARGETS
File changed: fbcode//vizard/test/quantization/test_functional.py
File changed: fbcode//vizard/quantization/prepare.py
Buck UI: https://www.internalfb.com/buck2/2726627a-31ec-4dee-bb95-6f658eaec072
Test UI: https://www.internalfb.com/intern/testinfra/testrun/1407375219310414
Network: Up: 72KiB  Down: 138KiB  (reSessionID-923ad1fe-f756-41ef-a8e4-36b4577c283b)
Jobs completed: 47. Time elapsed: 1:21.6s.
Cache hits: 0%. Commands: 4 (cached: 0, remote: 0, local: 4)
Tests finished: Pass 9. Fail 0. Fatal 0. Skip 0. Build failure 0
```

Differential Revision: D48377683
  • Loading branch information
jiaxuzhu92 authored and facebook-github-bot committed Sep 19, 2023
1 parent 2c1554a commit b1039a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torch/ao/quantization/quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def insert_activation_post_process(m, special_act_post_process=None):
# TODO remove Dropout special after codebase stable
if type_before_parametrizations(child) in [nn.Dropout]:
continue
elif type_before_parametrizations(child) in [nnq.FloatFunctional, nnq.QFunctional]:
elif issubclass(type_before_parametrizations(child), (nnq.FloatFunctional, nnq.QFunctional)):
if needs_observation(child):
child.activation_post_process = get_activation_post_process(child.qconfig, device)
elif isinstance(child, _FusedModule):
Expand Down

0 comments on commit b1039a6

Please sign in to comment.