-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[quant][graphmode] Make HistogramObserver scriptable with @torch.jit.ignore
#27950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary: Make observers scriptable with `@torch.jit.ignore` Test Plan: python test/test_quantization.py Reviewers: pt1quant Subscribers: Tasks: Tags: [ghstack-poisoned]
… in graph mode" Summary: Make observers scriptable with `@torch.jit.ignore` Test Plan: python test/test_quantization.py Reviewers: pt1quant Subscribers: Tasks: Tags: [ghstack-poisoned]
… in graph mode" Summary: Make observers scriptable with `@torch.jit.ignore` Test Plan: python test/test_quantization.py Reviewers: pt1quant Subscribers: Tasks: Tags: [ghstack-poisoned]
… in graph mode" Summary: Make observers scriptable with `@torch.jit.ignore` Test Plan: python test/test_quantization.py Reviewers: pt1quant Subscribers: Tasks: Tags: [ghstack-poisoned]
… in graph mode" Summary: Make observers scriptable with `@torch.jit.ignore` Test Plan: python test/test_quantization.py Reviewers: pt1quant Subscribers: Tasks: Tags: [ghstack-poisoned]
… in graph mode" Summary: Make observers scriptable with `@torch.jit.ignore` Test Plan: python test/test_quantization.py Reviewers: pt1quant Subscribers: Tasks: Tags: [ghstack-poisoned]
… in graph mode" Summary: Make observers scriptable with `@torch.jit.ignore` Test Plan: python test/test_quantization.py Reviewers: pt1quant Subscribers: Tasks: Tags: [ghstack-poisoned]
… in graph mode" Summary: Make observers scriptable with `@torch.jit.ignore` Test Plan: python test/test_quantization.py Reviewers: pt1quant Subscribers: Tasks: Tags: [ghstack-poisoned]
… in graph mode" Summary: Make HistogramObserver scriptable with `@torch.jit.ignore` Test Plan: python test/test_quantization.py Reviewers: pt1quant Subscribers: Tasks: Tags: [ghstack-poisoned]
…`@torch.jit.ignore`" Summary: att Test Plan: python test/test_quantization.py Reviewers: pt1quant Subscribers: Tasks: Tags: [ghstack-poisoned]
@torch.jit.ignore
|
This is ready for review please take a look |
ZolotukhinM
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but please remove unnecessary changes and split out unrelated changes and avoid that in future.
torch/csrc/jit/script/module.cpp
Outdated
| r.register_attribute( | ||
| s.name, | ||
| s.value.type(), | ||
| type()->getAttribute(s.name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an unrelated change.
| def _combine_histograms( | ||
| self, dst_histogram, dst_min, dst_max, src_histogram, src_min, src_max | ||
| ): | ||
| # type: (Tensor, float, float, Tensor, float, float) -> Tensor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need this if the function is ignored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, we need this otherwise everything will be treated as Tensor
| # remaining should go to dst_bin2 | ||
| if dst_bin_cnt < src_bin_count: | ||
| dst_histogram[dst_bin2] += src_bin_count - dst_bin_cnt | ||
| return dst_histogram |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be an unnecessary change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is needed for compile as well, ignored functions seems to take Tensor as return only
…`@torch.jit.ignore`" Summary: att Test Plan: python test/test_quantization.py Reviewers: pt1quant Subscribers: Tasks: Tags: [ghstack-poisoned]
…`@torch.jit.ignore`" Summary: att Test Plan: python test/test_quantization.py Reviewers: pt1quant Subscribers: Tasks: Tags: Differential Revision: [D18360139](https://our.internmc.facebook.com/intern/diff/D18360139) [ghstack-poisoned]
…`@torch.jit.ignore`" Summary: att Test Plan: python test/test_quantization.py Reviewers: pt1quant Subscribers: Tasks: Tags: Differential Revision: [D18360139](https://our.internmc.facebook.com/intern/diff/D18360139) [ghstack-poisoned]
|
This pull request has been merged in 4bcf479. |
….ignore` Summary: att Test Plan: python test/test_quantization.py Reviewers: pt1quant Subscribers: Tasks: Tags: ghstack-source-id: add7f5d Pull Request resolved: pytorch/pytorch#27950
Stack from ghstack:
torch.jit.ignore#29416 [quant] Make PerChannelMinMaxObserver scriptable usingtorch.jit.ignore@torch.jit.ignore#27950 [quant][graphmode] Make HistogramObserver scriptable with@torch.jit.ignoreSummary:
att
Test Plan:
python test/test_quantization.py
Reviewers:
pt1quant
Subscribers:
Tasks:
Tags:
Differential Revision: D18360139