Skip to content

quantized tensor: add preliminary support for advanced indexing, try 2#49346

Closed
vkuzo wants to merge 6 commits intogh/vkuzo/188/basefrom
gh/vkuzo/188/head
Closed

quantized tensor: add preliminary support for advanced indexing, try 2#49346
vkuzo wants to merge 6 commits intogh/vkuzo/188/basefrom
gh/vkuzo/188/head

Conversation

@vkuzo
Copy link
Copy Markdown
Contributor

@vkuzo vkuzo commented Dec 14, 2020

Stack from ghstack:

Summary:

This is less ambitious redo of
#49129.

We make the

xq_slice = xq[:, [0], :, :]

indexing syntax work if xq is a quantized Tensor. For now, we are
making the code not crash, with an in efficient dq -> index -> q
implementation. A future PR can optimize performance by removing
the unnecessary memory copies (which will require some non-trivial
changes to TensorIterator).

Test Plan:

python test/test_quantization.py TestQuantizedOps.test_advanced_indexing

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D25539365

Summary:

This is less ambitious redo of
#49129.

We make the

```
xq_slice = xq[:, [0], :, :]
```

indexing syntax work if `xq` is a quantized Tensor.  For now, we are
making the code not crash, with an in efficient `dq -> index -> q`
implementation.  A future PR can optimize performance by removing
the unnecessary memory copies (which will require some non-trivial
changes to TensorIterator).

Test Plan:

```
python test/test_quantization.py TestQuantizedOps.test_advanced_indexing
```

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Comment thread test/quantization/test_quantized_op.py Outdated
Comment thread aten/src/ATen/native/TensorAdvancedIndexing.cpp
Comment thread test/quantization/test_quantized_op.py Outdated
…for advanced indexing, try 2"

Summary:

This is less ambitious redo of
#49129.

We make the

```
xq_slice = xq[:, [0], :, :]
```

indexing syntax work if `xq` is a quantized Tensor.  For now, we are
making the code not crash, with an in efficient `dq -> index -> q`
implementation.  A future PR can optimize performance by removing
the unnecessary memory copies (which will require some non-trivial
changes to TensorIterator).

Test Plan:

```
python test/test_quantization.py TestQuantizedOps.test_advanced_indexing
```

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
…dexing, try 2"

Summary:

This is less ambitious redo of
#49129.

We make the

```
xq_slice = xq[:, [0], :, :]
```

indexing syntax work if `xq` is a quantized Tensor.  For now, we are
making the code not crash, with an in efficient `dq -> index -> q`
implementation.  A future PR can optimize performance by removing
the unnecessary memory copies (which will require some non-trivial
changes to TensorIterator).

Test Plan:

```
python test/test_quantization.py TestQuantizedOps.test_advanced_indexing
```

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
vkuzo added a commit that referenced this pull request Dec 14, 2020
Summary:

This is less ambitious redo of
#49129.

We make the

```
xq_slice = xq[:, [0], :, :]
```

indexing syntax work if `xq` is a quantized Tensor.  For now, we are
making the code not crash, with an in efficient `dq -> index -> q`
implementation.  A future PR can optimize performance by removing
the unnecessary memory copies (which will require some non-trivial
changes to TensorIterator).

Test Plan:

```
python test/test_quantization.py TestQuantizedOps.test_advanced_indexing
```

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 9540251
Pull Request resolved: #49346
Comment thread test/quantization/test_quantized_op.py Outdated
…ed indexing, try 2"

Summary:

This is less ambitious redo of
#49129.

We make the

```
xq_slice = xq[:, [0], :, :]
```

indexing syntax work if `xq` is a quantized Tensor.  For now, we are
making the code not crash, with an in efficient `dq -> index -> q`
implementation.  A future PR can optimize performance by removing
the unnecessary memory copies (which will require some non-trivial
changes to TensorIterator).

Test Plan:

```
python test/test_quantization.py TestQuantizedOps.test_advanced_indexing
```

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
vkuzo added a commit that referenced this pull request Dec 14, 2020
Summary:

This is less ambitious redo of
#49129.

We make the

```
xq_slice = xq[:, [0], :, :]
```

indexing syntax work if `xq` is a quantized Tensor.  For now, we are
making the code not crash, with an in efficient `dq -> index -> q`
implementation.  A future PR can optimize performance by removing
the unnecessary memory copies (which will require some non-trivial
changes to TensorIterator).

Test Plan:

```
python test/test_quantization.py TestQuantizedOps.test_advanced_indexing
```

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: c319b52
Pull Request resolved: #49346
@vkuzo vkuzo requested a review from jerryzh168 December 14, 2020 23:00
@facebook-github-bot
Copy link
Copy Markdown
Contributor

facebook-github-bot commented Dec 14, 2020

💊 CI failures summary and remediations

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


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-CircleCI 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.

This comment has been revised 10 times.

…exing, try 2"

Summary:

This is less ambitious redo of
#49129.

We make the

```
xq_slice = xq[:, [0], :, :]
```

indexing syntax work if `xq` is a quantized Tensor.  For now, we are
making the code not crash, with an in efficient `dq -> index -> q`
implementation.  A future PR can optimize performance by removing
the unnecessary memory copies (which will require some non-trivial
changes to TensorIterator).

Test Plan:

```
python test/test_quantization.py TestQuantizedOps.test_advanced_indexing
```

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
TORCH_INTERNAL_ASSERT(
self.qscheme() == c10::kPerTensorAffine ||
self.qscheme() == c10::kPerTensorSymmetric,
"Indexing for per-channel quantized Tensors is not supported.");
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.

nit: message should probably be only per-tensor quantized Tensor is supported

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, thanks for addressing the comments. had one nit comment inline.

…exing, try 2"

Summary:

This is less ambitious redo of
#49129.

We make the

```
xq_slice = xq[:, [0], :, :]
```

indexing syntax work if `xq` is a quantized Tensor.  For now, we are
making the code not crash, with an in efficient `dq -> index -> q`
implementation.  A future PR can optimize performance by removing
the unnecessary memory copies (which will require some non-trivial
changes to TensorIterator).

Test Plan:

```
python test/test_quantization.py TestQuantizedOps.test_advanced_indexing
```

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
vkuzo added a commit that referenced this pull request Dec 16, 2020
Summary:

This is less ambitious redo of
#49129.

We make the

```
xq_slice = xq[:, [0], :, :]
```

indexing syntax work if `xq` is a quantized Tensor.  For now, we are
making the code not crash, with an in efficient `dq -> index -> q`
implementation.  A future PR can optimize performance by removing
the unnecessary memory copies (which will require some non-trivial
changes to TensorIterator).

Test Plan:

```
python test/test_quantization.py TestQuantizedOps.test_advanced_indexing
```

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 7591b5f
Pull Request resolved: #49346
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 16, 2020

Codecov Report

Merging #49346 (e788c68) into gh/vkuzo/188/base (16f4b0e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@                Coverage Diff                 @@
##           gh/vkuzo/188/base   #49346   +/-   ##
==================================================
  Coverage              80.62%   80.62%           
==================================================
  Files                   1875     1875           
  Lines                 202771   202781   +10     
==================================================
+ Hits                  163488   163497    +9     
- Misses                 39283    39284    +1     

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in a9137ae.

hwangdeyu pushed a commit to hwangdeyu/pytorch that referenced this pull request Jan 6, 2021
pytorch#49346)

Summary:
Pull Request resolved: pytorch#49346

This is less ambitious redo of
pytorch#49129.

We make the

```
xq_slice = xq[:, [0], :, :]
```

indexing syntax work if `xq` is a quantized Tensor.  For now, we are
making the code not crash, with an in efficient `dq -> index -> q`
implementation.  A future PR can optimize performance by removing
the unnecessary memory copies (which will require some non-trivial
changes to TensorIterator).

Test Plan:
```
python test/test_quantization.py TestQuantizedOps.test_advanced_indexing
```

Imported from OSS

Reviewed By: jerryzh168

Differential Revision: D25539365

fbshipit-source-id: 98485875aaaf5743e1a940e170258057691be4fa
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.

4 participants