[quant][graphmode] Move hardtanh to general value ops map#38164
[quant][graphmode] Move hardtanh to general value ops map#38164jerryzh168 wants to merge 8 commits intogh/jerryzh168/307/basefrom
Conversation
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit f883362 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker. This comment has been revised 17 times. |
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
| std::string hardtanh = R"( | ||
| graph(%a_quant, %min, %max): | ||
| %a_dequant = aten::dequantize(%a_quant) | ||
| %r = aten::hardtanh(%a_dequant, %min, %max) |
There was a problem hiding this comment.
For hardtanh, the scale and zero-point are determined based on the min/max arguments to aten. There are a subset of ops where the scale and zero-point are functions of the op itself (not dependent on the input tensor) (hardtanh for example). We also have a larger set (avg_pool, interpolate where we are assuming that the output scale is the same as that of the input). Do we distinguish between these two types?
There was a problem hiding this comment.
qparams for hardtanh/clamp are inherited from input tensor: https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/native/quantized/cpu/qclamp.cpp#L48.
Yes, I have another PR coming up to handle the ops that have fixed qparams.
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
|
stamping per @jerryzh168 's request |
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
|
This pull request has been merged in 98d78a7. |
) Summary: Pull Request resolved: pytorch#38164 Test Plan: Imported from OSS Differential Revision: D21559808 fbshipit-source-id: 7b00e40cfa58806ce8675a61073778c4d77f8a8b
Stack from ghstack:
Summary:
Test Plan:
Reviewers:
Subscribers:
Tasks:
Tags:
Differential Revision: D21559808