Skip to content

fake_quant: fix device affinity and buffer resizing for state_dict#50868

Closed
vkuzo wants to merge 2 commits intogh/vkuzo/213/basefrom
gh/vkuzo/213/head
Closed

fake_quant: fix device affinity and buffer resizing for state_dict#50868
vkuzo wants to merge 2 commits intogh/vkuzo/213/basefrom
gh/vkuzo/213/head

Conversation

@vkuzo
Copy link
Copy Markdown
Contributor

@vkuzo vkuzo commented Jan 21, 2021

Stack from ghstack:

Summary:

Ensures that FakeQuantize respects device affinity when loading from
state_dict, and knows how to resize scale and zero_point values
(which is necessary for FQ classes wrapping per channel observers).

This is same as #44537, but for
FakeQuantize.

Test Plan:

python test/test_quantization.py TestObserver.test_state_dict_respects_device_affinity

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D25991570

Summary:

Ensures that `FakeQuantize` respects device affinity when loading from
state_dict, and knows how to resize scale and zero_point values
(which is necessary for FQ classes wrapping per channel observers).

This is same as #44537, but for
`FakeQuantize`.

Test Plan:

```
python test/test_quantization.py TestObserver.test_state_dict_respects_device_affinity
```

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
vkuzo added a commit that referenced this pull request Jan 21, 2021
Summary:

Ensures that `FakeQuantize` respects device affinity when loading from
state_dict, and knows how to resize scale and zero_point values
(which is necessary for FQ classes wrapping per channel observers).

This is same as #44537, but for
`FakeQuantize`.

Test Plan:

```
python test/test_quantization.py TestObserver.test_state_dict_respects_device_affinity
```

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 737eefd
Pull Request resolved: #50868
@vkuzo vkuzo requested review from jerryzh168 and supriyar January 21, 2021 22:09
Comment thread torch/quantization/fake_quantize.py Outdated
Comment thread torch/quantization/fake_quantize.py
Copy link
Copy Markdown
Contributor

@jerryzh168 jerryzh168 left a comment

Choose a reason for hiding this comment

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

LG

…ate_dict"

Summary:

Ensures that `FakeQuantize` respects device affinity when loading from
state_dict, and knows how to resize scale and zero_point values
(which is necessary for FQ classes wrapping per channel observers).

This is same as #44537, but for
`FakeQuantize`.

Test Plan:

```
python test/test_quantization.py TestObserver.test_state_dict_respects_device_affinity
```

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
vkuzo added a commit that referenced this pull request Jan 25, 2021
Summary:

Ensures that `FakeQuantize` respects device affinity when loading from
state_dict, and knows how to resize scale and zero_point values
(which is necessary for FQ classes wrapping per channel observers).

This is same as #44537, but for
`FakeQuantize`.

Test Plan:

```
python test/test_quantization.py TestObserver.test_state_dict_respects_device_affinity
```

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 317bd8b
Pull Request resolved: #50868
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 25, 2021

Codecov Report

Merging #50868 (b44b140) into gh/vkuzo/213/base (f7b339d) will decrease coverage by 0.00%.
The diff coverage is 55.55%.

@@                  Coverage Diff                  @@
##           gh/vkuzo/213/base   #50868      +/-   ##
=====================================================
- Coverage              80.91%   80.91%   -0.01%     
=====================================================
  Files                   1926     1926              
  Lines                 210014   210022       +8     
=====================================================
+ Hits                  169942   169943       +1     
- Misses                 40072    40079       +7     

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in f8eefbd.

@facebook-github-bot facebook-github-bot deleted the gh/vkuzo/213/head branch January 29, 2021 15:21
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
…ytorch#50868)

Summary:
Pull Request resolved: pytorch#50868

Ensures that `FakeQuantize` respects device affinity when loading from
state_dict, and knows how to resize scale and zero_point values
(which is necessary for FQ classes wrapping per channel observers).

This is same as pytorch#44537, but for
`FakeQuantize`.

Test Plan:
```
python test/test_quantization.py TestObserver.test_state_dict_respects_device_affinity
```

Imported from OSS

Reviewed By: jerryzh168

Differential Revision: D25991570

fbshipit-source-id: 1193a6cd350bddabd625aafa0682e2e101223bb1
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