Skip to content

Commit

Permalink
[quant][graphmode][fx] Add warning for unsupported case
Browse files Browse the repository at this point in the history
Summary:
Hit the problem when writing a test like following:
```
class M(...):
      def forward(self, x):
          x = x.some_op()
          return x
```
we need to know the scope of `x` to figure out the qconfig for `x`

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 3d3fe552470707374782ba89272d7d4473d1df13
Pull Request resolved: #45714
  • Loading branch information
jerryzh168 committed Oct 5, 2020
1 parent 87fd3fd commit 67c97ba
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion torch/quantization/fx/quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
)

from collections import OrderedDict
import warnings
import copy
import re

Expand Down Expand Up @@ -295,7 +296,13 @@ def get_qconfig(module_name):
elif node.op == 'call_method':
self_obj = node.args[0]
# qconfig for call_method should be the same as the `self` object for the call
self.qconfig_map[node.name] = self.qconfig_map[self_obj.name]
if self_obj.name in self.qconfig_map:
qconfig = self.qconfig_map[self_obj.name]
else:
# need scope info for each node to support this
warnings.warn("Scope info is not yet supported, taking default qconfig for value {}".format(node.name))
qconfig = get_qconfig('')
self.qconfig_map[node.name] = qconfig
elif node.op == 'call_module':
module_qconfig = get_qconfig(node.target)
# regex is not supported eager mode propagate_qconfig_, we'll need to
Expand Down

0 comments on commit 67c97ba

Please sign in to comment.