Skip to content

[quant][graphmode] Move hardtanh to general value ops map#38164

Closed
jerryzh168 wants to merge 8 commits intogh/jerryzh168/307/basefrom
gh/jerryzh168/307/head
Closed

[quant][graphmode] Move hardtanh to general value ops map#38164
jerryzh168 wants to merge 8 commits intogh/jerryzh168/307/basefrom
gh/jerryzh168/307/head

Conversation

@jerryzh168
Copy link
Copy Markdown
Contributor

@jerryzh168 jerryzh168 commented May 8, 2020

Stack from ghstack:

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D21559808

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@dr-ci
Copy link
Copy Markdown

dr-ci Bot commented May 8, 2020

💊 CI failures summary and remediations

As 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.

See how this bot performed.

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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]
@vkuzo
Copy link
Copy Markdown
Contributor

vkuzo commented May 12, 2020

stamping per @jerryzh168 's request

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 98d78a7.

@facebook-github-bot facebook-github-bot deleted the gh/jerryzh168/307/head branch May 17, 2020 14:18
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
)

Summary: Pull Request resolved: pytorch#38164

Test Plan: Imported from OSS

Differential Revision: D21559808

fbshipit-source-id: 7b00e40cfa58806ce8675a61073778c4d77f8a8b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants