Skip to content

Commit

Permalink
Update on "[quant] Quantizable LSTM"
Browse files Browse the repository at this point in the history
- Introduces the `torch.nn.quantizable` namespace
- Adds the `torch.nn.quantizable.LSTM` module

The point of the `quantizable` namespace is to segregate the purely quantized modules with the modules that could be quantized through a normal quantization flow, but are not using the quantized kernels explicitly.
That means the quantizable modules are functionally and numerically equivalent to the FP ones and can be used instead of the FP ones without any loss.

The main difference between the `torch.nn.LSTM` and the `torch.nn.quantizable.LSTM` is that the former one does not support observation for the linear layers, because all the computation is internal to the `aten` namespace.
The `torch.nn.quantizable.LSTM`, however, uses explicit linear layers that can be observed for further quantization.

Test Plan:

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

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

[ghstack-poisoned]
  • Loading branch information
z-a-f committed Dec 30, 2020
2 parents 8d85aeb + a5f6286 commit 25384e6
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 25384e6

Please sign in to comment.