Skip to content

[quant][graphmode][fx] Skip observering boolean Tensors #57375

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

Closed
wants to merge 4 commits into from

Conversation

jerryzh168
Copy link
Contributor

@jerryzh168 jerryzh168 commented Apr 30, 2021

Stack from ghstack:

Summary:
Skip observing the input for masked_fill. Currently we don't have a way to
query the type of Proxy in GraphModule, hopefully we should have the functionality to annotate the type,
we'll need to annotate a Proxy to be a boolean Tensor to remove this hack.

Test Plan:
python test/test_quantization.py TestQuantizeFxOps.test_boolean_tensor

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D28126003

Summary:
Skip observing the input for masked_fill. Currently we don't have a way to
query the type of Proxy in GraphModule, hopefully we should have the functionality to annotate the type,
we'll need to annotate a Proxy to be a boolean Tensor to remove this hack.

Test Plan:
python test/test_quantization.py TestQuantizeFxOps.test_boolean_tensor

Reviewers:

Subscribers:

Tasks:

Tags:

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

facebook-github-bot commented Apr 30, 2021

💊 CI failures summary and remediations

As of commit 13c4695 (more details on the Dr. CI page):


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-scanned failure(s)

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 to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

jerryzh168 added a commit that referenced this pull request Apr 30, 2021
Summary:
Skip observing the input for masked_fill. Currently we don't have a way to
query the type of Proxy in GraphModule, hopefully we should have the functionality to annotate the type,
we'll need to annotate a Proxy to be a boolean Tensor to remove this hack.

Test Plan:
python test/test_quantization.py TestQuantizeFxOps.test_boolean_tensor

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: fa69fca
Pull Request resolved: #57375
Summary:
Skip observing the input for masked_fill. Currently we don't have a way to
query the type of Proxy in GraphModule, hopefully we should have the functionality to annotate the type,
we'll need to annotate a Proxy to be a boolean Tensor to remove this hack.

Test Plan:
python test/test_quantization.py TestQuantizeFxOps.test_boolean_tensor

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
@jerryzh168 jerryzh168 requested a review from vkuzo April 30, 2021 21:44
Summary:
Skip observing the input for masked_fill. Currently we don't have a way to
query the type of Proxy in GraphModule, hopefully we should have the functionality to annotate the type,
we'll need to annotate a Proxy to be a boolean Tensor to remove this hack.

Test Plan:
python test/test_quantization.py TestQuantizeFxOps.test_boolean_tensor

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
# it is boolean Tensor
# TODO: we need type info from proxy, what type of Tensor this is
# similar to TorchScript
if (node.op, node.target) == ("call_method", "masked_fill"):
Copy link
Contributor

Choose a reason for hiding this comment

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

could we instead structure this as something like https://github.com/pytorch/pytorch/blob/master/torch/quantization/fx/utils.py#L406,

if second_input_arg_is_boolean_tensor(node):
  ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

Summary:
Skip observing the input for masked_fill. Currently we don't have a way to
query the type of Proxy in GraphModule, hopefully we should have the functionality to annotate the type,
we'll need to annotate a Proxy to be a boolean Tensor to remove this hack.

Test Plan:
python test/test_quantization.py TestQuantizeFxOps.test_boolean_tensor

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
jerryzh168 added a commit that referenced this pull request Apr 30, 2021
Summary:
Skip observing the input for masked_fill. Currently we don't have a way to
query the type of Proxy in GraphModule, hopefully we should have the functionality to annotate the type,
we'll need to annotate a Proxy to be a boolean Tensor to remove this hack.

Test Plan:
python test/test_quantization.py TestQuantizeFxOps.test_boolean_tensor

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: dbe46f6
Pull Request resolved: #57375
@codecov
Copy link

codecov bot commented May 1, 2021

Codecov Report

Merging #57375 (13c4695) into gh/jerryzh168/590/base (0a9c9cc) will decrease coverage by 0.35%.
The diff coverage is 100.00%.

@@                    Coverage Diff                     @@
##           gh/jerryzh168/590/base   #57375      +/-   ##
==========================================================
- Coverage                   77.63%   77.27%   -0.36%     
==========================================================
  Files                        1956     1956              
  Lines                      194841   194853      +12     
==========================================================
- Hits                       151260   150581     -679     
- Misses                      43581    44272     +691     

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 945c93b.

@facebook-github-bot facebook-github-bot deleted the gh/jerryzh168/590/head branch May 7, 2021 14:15
krshrimali pushed a commit to krshrimali/pytorch that referenced this pull request May 19, 2021
Summary:
Pull Request resolved: pytorch#57375

Skip observing the input for masked_fill. Currently we don't have a way to
query the type of Proxy in GraphModule, hopefully we should have the functionality to annotate the type,
we'll need to annotate a Proxy to be a boolean Tensor to remove this hack.

Test Plan:
python test/test_quantization.py TestQuantizeFxOps.test_boolean_tensor

Imported from OSS

Reviewed By: vkuzo

Differential Revision: D28126003

fbshipit-source-id: 2989766370a607579b3ea07ca36cdc2ce35893cc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants