pytorch/test
Edward Z. Yang 55b6295e02 Update on "Turn on strict dtype checking for test_torch.py"
Partially addresses #20376

I do this by overriding assertEqual in classes that opt into
this.  This means I have to fix #33821.  The fix is a little
unsatisfactory as idiomatic Python 2 super() calls don't work
(since the class is no longer in scope); hopefully this will just
work when we go to Python 3.

General approach taken:
- A lot of dtype mismatches are because we specified tensor constants
  that infer to some dtype, but the actual dtype needed is something else.
  Those are easy, just annotate the tensor() constructor (often a legacy
  Tensor/FloatTensor call) with dtype
- There are a few cases where the promotion rules are nontrivial.  Some of them
  I just typed out the expected promotion rules manually (based on trial
  and error)
- There are some more complex cases; if it gets too hairy I just
  set exact_dtype=False and nope the fuck out

I don't have time to do it for all the other classes.  But the setup
should work if people just incrementally add the overrides to classes,
and then eventually flip the default.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

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

[ghstack-poisoned]
2020-02-28 11:59:00 -08:00
..
backward_compatibility disable leaky_relu_ backward calculation with negative slope (#33639) 2020-02-27 18:54:57 -08:00
bottleneck_test fix possible pandas import error during tensorboard tests (#29650) 2020-02-04 14:27:46 -08:00
cpp Revert D20127441: [pytorch][PR] [JIT] Introduce a fake Tensor creation node for IR unit tests 2020-02-27 13:48:31 -08:00
cpp_api_parity [C++ API] Add PackedSequence / pack_padded_sequence / pad_packed_sequence / pack_sequence (#33652) 2020-02-25 12:53:41 -08:00
cpp_extensions Delete unnecessary aliasAnalysis specification from operator registrations. (#33093) 2020-02-21 14:24:44 -08:00
custom_operator Separate torchbind from Python (#30242) 2019-12-21 22:52:40 -08:00
distributed remove .data from test/distributed/ (#33874) 2020-02-27 13:14:29 -08:00
error_messages Use latest stable flake8-bugbear in CI and fix B011 flake8 error. (#21944) 2019-06-24 20:48:15 -07:00
expect Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
jit [JIT] Implement Tensor.tolist() (#33472) 2020-02-27 21:45:46 -08:00
mobile/op_deps Delete unnecessary aliasAnalysis specification from operator registrations. (#33093) 2020-02-21 14:24:44 -08:00
onnx [ONNX] Adding ONNX large model export support in exporter (#33062) 2020-02-18 20:51:43 -08:00
optim Implement AdamW optimizer (#21250) 2019-07-02 09:09:10 -07:00
scripts Make test_torch.py pass cuda-memcheck (#29243) 2019-12-14 20:29:58 -08:00
HowToWriteTestsUsingFileCheck.md
run_test.py Add missing test launchers for JitRpcTest and JitDistAutogradTest (#32891) 2020-02-24 21:42:47 -08:00
simulate_nccl_errors.py Detect and handle NCCL errors appropriately in ProcessGroupNCCL. (#25012) 2019-08-22 16:12:41 -07:00
test_autograd.py disable leaky_relu_ backward calculation with negative slope (#33639) 2020-02-27 18:54:57 -08:00
test_complex.py Added tensor.is_complex(), is_complex and dtype.is_complex py binding, tensor printing, and dixed the scalar type returned for complex float (#33268) 2020-02-20 13:38:01 -08:00
test_cpp_api_parity.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_cpp_extensions_aot.py [ROCm] Added support for pytorch extensions to use HIP (#32669) 2020-02-21 12:10:02 -08:00
test_cpp_extensions_jit.py Add pybind11 exception translator (#30588) 2020-02-18 11:33:29 -08:00
test_cuda_primary_ctx.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_cuda.py [WIP] Reanimate gradient scaling API with original scale update heuristic (#33366) 2020-02-25 19:00:34 -08:00
test_dataloader.py Fix all occurrences of C416. (#33429) 2020-02-21 08:32:22 -08:00
test_distributions.py Feature/vonmises upstream (#33418) 2020-02-26 08:19:12 -08:00
test_docs_coverage.py Fix test_docs_coverage. 2019-10-15 12:20:13 -07:00
test_expecttest.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_fake_quant.py Per channel quantization performance improvement (#33772) 2020-02-26 10:19:25 -08:00
test_function_schema.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_indexing.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_jit_disabled.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_jit_fuser_legacy.py switching to a simple/full executor 2019-11-11 13:41:35 -08:00
test_jit_fuser.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_jit_legacy.py switching to a simple/full executor 2019-11-11 13:41:35 -08:00
test_jit_py3.py Remove prim::Constant op (#32804) 2020-02-18 15:06:56 -08:00
test_jit_simple.py switching to a simple/full executor 2019-11-11 13:41:35 -08:00
test_jit_string.py [PyTorch][TorchScript] Add support for join on List of strings in TorchScript (#32847) 2020-01-31 18:20:38 -08:00
test_jit.py [jit] stop printing crap in test_jit (#33917) 2020-02-27 19:06:43 -08:00
test_logging.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_mkldnn.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_multiprocessing_spawn.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_multiprocessing.py Better handing of Autograd+Fork errors. (#33885) 2020-02-27 16:07:29 -08:00
test_namedtensor.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_namedtuple_return_api.py Added cummin 2020-01-17 10:51:58 -08:00
test_nn.py Migrate random_ from the TH to Aten (CPU and CUDA) (#33663) 2020-02-27 05:05:42 -08:00
test_numba_integration.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_optim.py Add missing weight_decay parameter validation for Adam and AdamW (#33126) 2020-02-20 11:11:51 -08:00
test_overrides.py __torch_function__ overrides for torch.functional and torch.nn.functional (#32799) 2020-02-21 08:38:37 -08:00
test_qat.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_quantization.py Back out "[pt][quant] RNN debug test" (#33750) 2020-02-25 09:28:00 -08:00
test_quantized_models.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_quantized_nn_mods.py [quant] Add Quantized BatchNorm2d module (#33109) 2020-02-13 12:15:43 -08:00
test_quantized_tensor.py Preserve Backward compatibility of models serialized before #31040 (#33796) 2020-02-26 13:40:38 -08:00
test_quantized.py Support broadcast for quantized mul kernel (#30442) 2020-02-19 16:52:31 -08:00
test_serialization.py Avoid problematic pickle usages on Python 3.8.0 and 3.8.1 (#33824) 2020-02-26 21:15:38 -08:00
test_sparse.py Fixes cuda->numpy and non-strided->numpy segfaults (#33612) 2020-02-21 22:23:08 -08:00
test_tensorboard.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_throughput_benchmark.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_torch.py Update on "Turn on strict dtype checking for test_torch.py" 2020-02-27 12:13:21 -08:00
test_type_hints.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_type_info.py Move pytorch distributed tests to separate folder for contbuild. (#30445) 2020-01-22 21:16:59 -08:00
test_type_promotion.py Add device to the test tensor. Default device type is CPU, in pytorch… (#33635) 2020-02-27 14:40:07 -08:00
test_utils.py Consider hub_dir alongside TORCH_HOME env variable for storing hub models (#32844) 2020-02-05 15:35:53 -08:00