pytorch/test
HDCharles c5224bc2e1 [quant] Add QuantizedMHA class
The nn.MultiheadAttention is quantized through the custom module mechanism, which uses the nn.quantizable.MultiheadAttention for both observed and quantized paths. This is potentially a source of confusion. This creates a quantized.MultiheadAttention class, which completely takes the quantized path. Note that after this, the old usage will throw an error.
New way of using it:

```
>>> custom_module_config = {
...     'float_to_observed_custom_module_class': {
...         nn.MultiheadAttention: nn.quantizable.MultiheadAttention,
...     },
...     'observed_to_quantized_custom_module_class': {
...         nn.quantizable.MultiheadAttention: nn.quantized.MultiheadAttention,
...     }
... }
>>> tq.prepare(model, prepare_custom_module_class=custom_module_config)
>>> tq.convert(model, convert_custom_module_class=custom_module_config)
```

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

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D33452179/)!

[ghstack-poisoned]
2022-01-06 10:12:17 -08:00
..
ao/sparsity [sparsity] Convert function for sparse kernels without a context manager (#66778) 2021-12-09 02:58:57 -08:00
autograd [skip ci] Set test owners for autograd tests (#66834) 2021-10-19 08:35:02 -07:00
benchmark_utils Add lint to ensure all test files have headers with ownership info (#66826) 2021-11-03 18:21:49 -07:00
bottleneck_test Set test owners for tests with unknown owners (#67552) 2021-10-29 12:42:01 -07:00
cpp Bump version number to 7 and compile old operators with old schema (#68358) 2022-01-05 23:57:22 -08:00
cpp_api_parity ENH Adds test and docs for modules that already support no batch dims (#62729) 2021-09-02 12:36:54 -07:00
cpp_extensions Resubmit #67161 (#67735) 2021-11-04 09:59:30 -07:00
custom_backend [PyTorch] Adopt IValue::toTupleRef() where obvious (#65505) 2021-11-02 10:22:18 -07:00
custom_operator Set test owners for tests with unknown owners (#67552) 2021-10-29 12:42:01 -07:00
distributed Add the maximize flag to AdamW (#70146) 2021-12-23 09:20:29 -08:00
distributions [Reinstate] Wishart distribution (#70377) 2021-12-30 11:41:46 -08:00
error_messages Revert D30279364: [codemod][lint][fbcode/c*] Enable BLACK by default 2021-08-12 11:45:01 -07:00
expect Fixed type checking errors in node.py (#68124) 2021-12-03 12:03:49 -08:00
forward_backward_compatibility Add forward compatability tests in CI (#64139) 2022-01-05 23:40:06 -08:00
fx [const_fold] Fix call_module const folding (#68614) 2021-11-18 20:56:06 -08:00
fx_acc [fx2trt] Add support for torch.mean (#70052) 2021-12-17 15:48:31 -08:00
fx2trt [quant] Add a e2e test for standalone module + custom backend_config_dict (#70152) 2022-01-02 11:20:50 -08:00
jit Bump version number to 7 and compile old operators with old schema (#68358) 2022-01-05 23:57:22 -08:00
jit_hooks Revert D30279364: [codemod][lint][fbcode/c*] Enable BLACK by default 2021-08-12 11:45:01 -07:00
mobile [Operator Verioning][Edge] Update upgrader codegen with latest change (#70293) 2021-12-28 18:34:31 -08:00
onnx [ONNX] Add BFloat16 type support when export to ONNX (#66788) 2021-12-14 12:23:32 -08:00
package [package] fix torchscript classes in package (#68028) 2021-11-16 10:01:40 -08:00
quantization [quant] Add QuantizedMHA class 2022-01-06 10:12:17 -08:00
scripts Revert D30279364: [codemod][lint][fbcode/c*] Enable BLACK by default 2021-08-12 11:45:01 -07:00
test_img
typing Deprecate QR (#57745) 2021-05-10 22:56:37 -07:00
delete.py Introducing DataChunk for DataPipes batching (#62768) 2021-08-06 08:38:33 -07:00
HowToWriteTestsUsingFileCheck.md Allow for heterogenous List and Dict values + Improve container typing algorithm (#57137) 2021-07-10 14:29:05 -07:00
linear.py Revert D30279364: [codemod][lint][fbcode/c*] Enable BLACK by default 2021-08-12 11:45:01 -07:00
run_test.py Skip distributed tests if built with USE_DISTRIBUTED=0 (#70677) 2022-01-06 08:55:05 -08:00
simulate_nccl_errors.py Revert D30279364: [codemod][lint][fbcode/c*] Enable BLACK by default 2021-08-12 11:45:01 -07:00
test_ao_sparsity.py [sparsity] Fix and enable the pruning tests (#66411) 2021-11-22 15:28:12 -08:00
test_autocast.py Set test owners for tests with unknown owners (#67552) 2021-10-29 12:42:01 -07:00
test_autograd.py Updates CUDA memory leak check to verify against driver API and print more diagnostic information (#69556) 2021-12-17 23:37:49 -08:00
test_binary_ufuncs.py Low precision support for jiterator (#70157) 2021-12-19 11:56:57 -08:00
test_bundled_images.py Add ownership to more edge tests (#67859) 2021-11-05 11:01:16 -07:00
test_bundled_inputs.py Add lint to ensure all test files have headers with ownership info (#66826) 2021-11-03 18:21:49 -07:00
test_complex.py [skip ci] Set test owner for test_complex.py (#66835) 2021-10-19 08:36:27 -07:00
test_cpp_api_parity.py [skip ci] Set test owners for cpp test (#66836) 2021-10-21 13:17:46 -07:00
test_cpp_extensions_aot.py Resubmit #67161 (#67735) 2021-11-04 09:59:30 -07:00
test_cpp_extensions_jit.py Remove remaining THC code (#69039) 2021-12-08 12:18:08 -08:00
test_cuda_primary_ctx.py [skip ci] Set test owner for test_cuda* tests (#66838) 2021-10-21 17:36:25 -07:00
test_cuda.py Increase tensor size for mem check tests (#70603) 2022-01-05 08:27:48 -08:00
test_dataloader.py [DataPipe] Control shuffle settings from DataLoader2 (#65756) 2021-12-14 07:35:26 -08:00
test_datapipe.py [DataPipe] Renaming FileLoader to FileOpener with deprecation warning for FileLoader (#70367) 2022-01-04 09:14:50 -08:00
test_deploy.py [skip ci] Set test owner for deploy/package tests (#66830) 2021-10-26 07:49:33 -07:00
test_determination.py Have test classes extend from common_utils.TestCase, not unittest.TestCase (#66900) 2021-10-19 16:54:05 -07:00
test_dispatch.py [skip ci] Set test owner for test_dispatch.py (#66840) 2021-10-21 08:48:37 -07:00
test_foreach.py Fix device type / dtype handling for parametrized test names (#65217) 2021-11-29 19:02:23 -08:00
test_function_schema.py Add forward compatability tests in CI (#64139) 2022-01-05 23:40:06 -08:00
test_functional_autograd_benchmark.py [skip ci] Add test owners for a special hi-pri class of tests (#67553) 2021-10-29 12:17:21 -07:00
test_functional_optim.py Add test owner to distributed files starting with test_ (#66797) 2021-10-19 10:55:20 -07:00
test_functionalization.py functionalization: update is_aliased() logic (#68881) 2021-12-02 09:19:12 -08:00
test_futures.py Set test owners for tests with unknown owners (#67552) 2021-10-29 12:42:01 -07:00
test_fx_experimental.py OpInfos for torch.{flatten, column_stack} (#69237) 2021-12-16 17:50:58 -08:00
test_fx.py OpInfos for: normal, bernoulli, multinomial (#66358) 2021-12-14 06:59:38 -08:00
test_import_stats.py Set test owners for module: ci (#66796) 2021-10-18 10:29:50 -07:00
test_indexing.py Fixes CUDA vs CPU consistency for index_put_ when accumulating (part 2) (#67189) 2021-11-08 17:56:43 -08:00
test_jit_autocast.py [JIT] additional support for CallMethod with autocasting (#67925) 2021-11-08 14:37:09 -08:00
test_jit_cuda_fuser.py Allow single node fusion for nvfuser (#70000) 2021-12-23 17:07:57 -08:00
test_jit_disabled.py Set test owners for jit tests (#66808) 2021-10-25 07:51:10 -07:00
test_jit_fuser_legacy.py Set test owners for jit tests (#66808) 2021-10-25 07:51:10 -07:00
test_jit_fuser_te.py Revert D33234529: [NNC Testing] Randomized loop nest infrastructure 2021-12-23 23:11:23 -08:00
test_jit_fuser.py skip test_jit_legacy (#68129) 2021-11-10 23:08:32 -08:00
test_jit_legacy.py Set test owners for jit tests (#66808) 2021-10-25 07:51:10 -07:00
test_jit_profiling.py Set test owners for jit tests (#66808) 2021-10-25 07:51:10 -07:00
test_jit_simple.py Set test owners for jit tests (#66808) 2021-10-25 07:51:10 -07:00
test_jit_string.py Set test owners for jit tests (#66808) 2021-10-25 07:51:10 -07:00
test_jit.py Bump version number to 7 and compile old operators with old schema (#68358) 2022-01-05 23:57:22 -08:00
test_kernel_launch_checks.py Set test owners for tests with unknown owners (#67552) 2021-10-29 12:42:01 -07:00
test_license.py Set test owners for tests with unknown owners (#67552) 2021-10-29 12:42:01 -07:00
test_linalg.py Remove random_fullrank_matrix_distinc_singular_value (#68183) 2022-01-05 20:33:37 -08:00
test_logging.py Set test owners for tests with unknown owners (#67552) 2021-10-29 12:42:01 -07:00
test_masked.py Strided masked var. (#68738) 2021-12-01 19:19:37 -08:00
test_metal.py [skip ci] Set test owner for mobile tests (#66829) 2021-10-26 10:20:01 -07:00
test_mkldnn.py Avoid the view for mkldnn case in 1D convolution (#68166) 2021-11-15 11:56:45 -08:00
test_mobile_optimizer.py [skip ci] Set test owner for mobile tests (#66829) 2021-10-26 10:20:01 -07:00
test_model_dump.py Add ownership to more edge tests (#67859) 2021-11-05 11:01:16 -07:00
test_module_init.py [quant][embedding qat] eager mode QAT for Embeddings (#66429) 2021-11-18 05:57:11 -08:00
test_modules.py Add testing across mem_formats to ModuleInfos (#69317) 2021-12-29 14:53:27 -08:00
test_multiprocessing_spawn.py make ProcessException pickleable (#70118) 2021-12-30 09:09:55 -08:00
test_multiprocessing.py [skip ci] Set test owner for multiprocessing tests (#66848) 2021-10-21 13:13:53 -07:00
test_namedtensor.py [skip ci] Set test owner for named tensor tests (#66849) 2021-10-21 08:22:26 -07:00
test_namedtuple_return_api.py Add linalg.lu_factor (#66933) 2022-01-05 20:32:12 -08:00
test_native_functions.py Set test owners for tests with unknown owners (#67552) 2021-10-29 12:42:01 -07:00
test_nn.py Remove repeat test for types in test nn (#70872) 2022-01-06 09:20:02 -08:00
test_nnapi.py Add ownership to more edge tests (#67859) 2021-11-05 11:01:16 -07:00
test_numba_integration.py Set test owners for tests with unknown owners (#67552) 2021-10-29 12:42:01 -07:00
test_numpy_interop.py [skip ci] Set test owner for test_numpy_interop.py (#66851) 2021-10-19 10:50:54 -07:00
test_openmp.py Set test owners for tests with unknown owners (#67552) 2021-10-29 12:42:01 -07:00
test_ops.py Do not use ZeroTensor for inplace ops (#69998) 2021-12-23 15:52:34 -08:00
test_optim.py Increase tolerance for test_adadelta (#69919) 2022-01-05 15:02:10 -08:00
test_overrides.py Add linalg.solve_triangular (#63568) 2021-11-22 12:41:06 -08:00
test_package.py [skip ci] Set test owner for deploy/package tests (#66830) 2021-10-26 07:49:33 -07:00
test_profiler.py record the datapipe for each pieces of Dataset (#67613) 2021-12-01 10:29:06 -08:00
test_pruning_op.py Set test owners for tests with unknown owners (#67552) 2021-10-29 12:42:01 -07:00
test_public_bindings.py Have test classes extend from common_utils.TestCase, not unittest.TestCase (#66900) 2021-10-19 16:54:05 -07:00
test_python_dispatch.py add python dispatch test back to CI and fix typo in test (#69565) 2021-12-08 08:44:49 -08:00
test_pytree.py [skip ci] Add test owners for a special hi-pri class of tests (#67553) 2021-10-29 12:17:21 -07:00
test_quantization.py dbr quant: break up test class into multiple classes (#70246) 2022-01-05 06:36:41 -08:00
test_reductions.py Updated searchsorted functionality (#66818) 2021-11-05 12:13:47 -07:00
test_segment_reductions.py Set test owners for tests with unknown owners (#67552) 2021-10-29 12:42:01 -07:00
test_serialization.py Avoid dtype mismatch error in torch.save if storages are unallocated (#68787) 2021-11-24 09:51:29 -08:00
test_set_default_mobile_cpu_allocator.py Add ownership to more edge tests (#67859) 2021-11-05 11:01:16 -07:00
test_shape_ops.py replace onlyOnCPUAndCUDA with onlyNativeDeviceTypes (#65201) 2021-11-01 09:22:34 -07:00
test_show_pickle.py Add ownership to more edge tests (#67859) 2021-11-05 11:01:16 -07:00
test_sort_and_select.py Implement topk with sort for some cases (#68632) 2021-11-19 17:18:20 -08:00
test_sparse_csr.py Support Sparse CSR transpose. Fix clang-tidy warnings. (#70582) 2022-01-05 17:41:51 -08:00
test_sparse.py OpInfo: Allow sample_inputs_func to be any iterable (#69256) 2021-12-09 08:37:26 -08:00
test_spectral_ops.py replace onlyOnCPUAndCUDA with onlyNativeDeviceTypes (#65201) 2021-11-01 09:22:34 -07:00
test_stateless.py [skip ci] Add test owners for a special hi-pri class of tests (#67553) 2021-10-29 12:17:21 -07:00
test_static_runtime.py [static runtime][dper] multi_env tests for static runtime: selective enable (#67467) 2021-11-18 01:04:12 -08:00
test_tensor_creation_ops.py Add meta support to tensor range factories (#67032) 2021-11-05 15:36:29 -07:00
test_tensorboard.py Set test owners for tests with unknown owners (#67552) 2021-10-29 12:42:01 -07:00
test_tensorexpr_pybind.py [tensorexpr] check for index out of bounds in ir_eval (#68858) 2021-12-16 09:27:45 -08:00
test_tensorexpr.py [skip ci] Set test owners for NNC tests (#66833) 2021-10-26 07:46:18 -07:00
test_testing.py Fix device type / dtype handling for parametrized test names (#65217) 2021-11-29 19:02:23 -08:00
test_throughput_benchmark.py Set test owners for tests with unknown owners (#67552) 2021-10-29 12:42:01 -07:00
test_torch.py Copy: Fix conj bit being ignored on type mismatch (#68963) 2022-01-05 17:59:32 -08:00
test_type_hints.py [skip ci] Set test owners for test_typing.py (#66869) 2021-10-20 09:41:13 -07:00
test_type_info.py [skip ci] Set test owners for test_typing.py (#66869) 2021-10-20 09:41:13 -07:00
test_type_promotion.py replace onlyOnCPUAndCUDA with onlyNativeDeviceTypes (#65201) 2021-11-01 09:22:34 -07:00
test_typing.py [skip ci] Set test owners for test_typing.py (#66869) 2021-10-20 09:41:13 -07:00
test_unary_ufuncs.py The Jiterator (#69439) 2021-12-06 07:32:48 -08:00
test_utils.py Add support for C++ frontend wrapper on Linux (#69094) 2021-12-02 16:47:00 -08:00
test_view_ops.py Add forward AD support for as_strided (#68629) 2021-12-14 04:33:05 -08:00
test_vmap.py update example in classification losses (#69816) 2021-12-21 02:46:48 -08:00
test_vulkan.py [skip ci] Set test owner for mobile tests (#66829) 2021-10-26 10:20:01 -07:00
test_xnnpack_integration.py Add ownership to more edge tests (#67859) 2021-11-05 11:01:16 -07:00