Skip to content

Commit

Permalink
Update on "quantized tensor: add preliminary support for advanced ind…
Browse files Browse the repository at this point in the history
…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]
  • Loading branch information
vkuzo committed Dec 16, 2020
1 parent 0add47e commit e788c68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aten/src/ATen/native/TensorAdvancedIndexing.cpp
Expand Up @@ -294,7 +294,7 @@ Tensor quantized_index(const Tensor & self, TensorList indices) {
TORCH_INTERNAL_ASSERT(
self.qscheme() == c10::kPerTensorAffine ||
self.qscheme() == c10::kPerTensorSymmetric,
"Indexing for per-channel quantized Tensors is not supported.");
"Indexing is only supported for per-Tensor quantized Tensors.");

// For now, this is a naive implementation which does dq -> index -> q.
// TODO(future PR): improve performance by removing the copies.
Expand Down

0 comments on commit e788c68

Please sign in to comment.