Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/40100
ELU has a range of [-1, inf]. In the original PR which added
the quantized operator we decided to pass the quantization params
from the input. However, it makes more sense to require observation
for this op.
This PR changes the API to require observation. Next PRs in this stack
will add the eager and graph mode handling.
Test Plan:
```
python test/test_quantization.py TestQuantizedOps.test_qelu
```
Imported from OSS
Differential Revision: D22075083
fbshipit-source-id: 0ea0fd05a00cc7a5f122a2b1de09144bbd586f32
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/40055
Noticed this while reading the `helper.cpp` file, seems like this op
should be in the `single_input_general_value` bucket.
Test Plan:
CI
Imported from OSS
Differential Revision: D22054257
fbshipit-source-id: 2ca16ff863d644cbd03c3938eeca0fb87e3e4638
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39645
This PR added quantization support for handling BatchNorm2d and ReLU(or F.relu) in both
scripting and tracing
Test Plan:
python test/test_quantization.py TestQuantizeScriptPTSQOps.test_qbatchnorm_relu
Imported from OSS
Differential Revision: D21942111
fbshipit-source-id: 680e16076a37b96d2485d5cbc39ce9a045c319c3
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39795
Replaces the `is_dynamic` bool by enums in Python and c++
graph quantization code. This makes the code more readable
and will make it easier to modify for adding QAT logic in the future.
Test Plan:
CI, as well as
```
python test/test_quantization.py TestQuantizeDynamicScript
python test/test_quantization.py TestQuantizeScriptJitPasses
```
Imported from OSS
Differential Revision: D21981643
fbshipit-source-id: d475760407bcc794aeae92a2c696bac4acda843d
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39219
We didn't model clamp ops correctly right now, this PR fixes that.
Reason is quantized clamp op quantizes the scalar arguments in the op implementation: https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/native/quantized/cpu/kernels/QuantizedOpKernels.cpp#L614-L617
So we'll need to model this explicitly in the IR.
When we see a `aten::dequantize - aten::clamp(%x, %min, %max)`
we first make a scalar tensor with `aten::scalar_tensor(%scalar, ...)`, then we quantize the tensor with the same quantization parameters from the input tensor of the `aten::clamp`, dequantize the tensor, then convert the dequantized tensor to scalar using `aten::item`.
Test Plan: Imported from OSS
Differential Revision: D21831350
fbshipit-source-id: d60731459a0465d64946aabc62065d25d92faefc
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/38570
We changed the rule of quantizing `aten::cat`, previously `aten::cat` is considered to be
an op that should always be quantized, like `aten::conv2d`, but this is not ideal, a better
way is to quantize the output of `aten::cat` depending on whether the input is quantized, if it is
then we'll quantize the output, if not, then we will not quantize the output, since `aten::cat` works both on
quantized and non-quantized tensor.
Test Plan: Imported from OSS
Differential Revision: D21600160
fbshipit-source-id: efa957e0eaa608fffefcdfefa7f442fab45605eb
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/38584
All observers will support tensor lists in future PR
Test Plan: Imported from OSS
Differential Revision: D21623464
fbshipit-source-id: c5c57ecfe14f7c3aa92b7c99d724e846132ae03b
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/38434
We insert dequantize for each use in order to produce quantization patterns that will
later be fused, after that we should also remove extra dequantize node produced by this operation.
Test Plan: Imported from OSS
Differential Revision: D21597834
fbshipit-source-id: 18dfb2760bbb08932aa4e1d06f96cfc5fb37ed88