Skip to content

[quant][graphmode] Add RemoveReduantDequantize pass#38434

Closed
jerryzh168 wants to merge 6 commits intogh/jerryzh168/316/basefrom
gh/jerryzh168/316/head
Closed

[quant][graphmode] Add RemoveReduantDequantize pass#38434
jerryzh168 wants to merge 6 commits intogh/jerryzh168/316/basefrom
gh/jerryzh168/316/head

Conversation

@jerryzh168
Copy link
Copy Markdown
Contributor

@jerryzh168 jerryzh168 commented May 13, 2020

Stack from ghstack:

Summary:
We insert dequantize for each use in order to produce quantization patterns that will
later be fused, after that we should also remove extra dequantize node produced by this operation.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D21597834

Summary:
We insert dequantize for each use in order to produce quantization patterns that will
later be fused, after that we should also remove extra dequantize node produced by this operation.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

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

dr-ci Bot commented May 13, 2020

💊 CI failures summary and remediations

As of commit 3fd43dc (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 30 times.

Summary:
We insert dequantize for each use in order to produce quantization patterns that will
later be fused, after that we should also remove extra dequantize node produced by this operation.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary:
We insert dequantize for each use in order to produce quantization patterns that will
later be fused, after that we should also remove extra dequantize node produced by this operation.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
def forward(self, x):
y = x.size(0)
x = self.conv(x)
return (x.size(0) + y) * x
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.

Why does this case have extra dequant? Is it due to x.size()?

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.

Yes

@jerryzh168
Copy link
Copy Markdown
Contributor Author

I thought about this again, and feel that this might not be very safe, since user can explicitly call dequantize as well, although that's rare, to be safe, I'll create a whitelist for ops that the dequantize can be removed for their input.

Summary:
We insert dequantize for each use in order to produce quantization patterns that will
later be fused, after that we should also remove extra dequantize node produced by this operation.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary:
We insert dequantize for each use in order to produce quantization patterns that will
later be fused, after that we should also remove extra dequantize node produced by this operation.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D21597834](https://our.internmc.facebook.com/intern/diff/D21597834)

[ghstack-poisoned]
Summary:
We insert dequantize for each use in order to produce quantization patterns that will
later be fused, after that we should also remove extra dequantize node produced by this operation.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D21597834](https://our.internmc.facebook.com/intern/diff/D21597834)

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

This pull request has been merged in 6232481.

@facebook-github-bot facebook-github-bot deleted the gh/jerryzh168/316/head branch May 19, 2020 14:16
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Pull Request resolved: pytorch#38434

We insert dequantize for each use in order to produce quantization patterns that will
later be fused, after that we should also remove extra dequantize node produced by this operation.

Test Plan: Imported from OSS

Differential Revision: D21597834

fbshipit-source-id: 18dfb2760bbb08932aa4e1d06f96cfc5fb37ed88
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.

4 participants