pytorch/test
Nikita Vedeneev 0048d97eda remove index_fill side-effect for scalar tensors (#52209)
Summary:
`index_fill` silently promotes zero dim Tensors to 1-dim Tensors. This PR fixes that.
Was:
```
In [1]: import torch

In [2]: x = torch.tensor(1)

In [3]: idx = torch.tensor(0).long()

In [4]: x.dim()
Out[4]: 0

In [5]: x.index_fill(0, idx, -1).dim()
Out[5]: 1

```
Now:
```
In [6]: x.index_fill(0, idx, -1).dim()
Out[6]: 0

```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52209

Reviewed By: ejguan

Differential Revision: D26446470

Pulled By: ngimel

fbshipit-source-id: 4737e6941a7216b57f3416b59362817834df3a3a
2021-02-25 00:35:27 -08:00
..
backward_compatibility make forward AD API private (#51693) 2021-02-04 19:02:29 -08:00
benchmark_utils Revert "Revert D25199264: Enable callgrind collection for C++ snippets" (#48720) 2020-12-02 11:10:11 -08:00
bottleneck_test
cpp [TensorExpr] Add an unmasked Load constructor. (#52790) 2021-02-24 22:45:29 -08:00
cpp_api_parity Add PixelUnshuffle (#49334) 2020-12-22 20:14:55 -08:00
cpp_extensions Move generator state APIs to ATen (#49589) 2021-01-06 18:26:56 -08:00
custom_backend Removes deprecated preprocess method from the backend interface (#52258) 2021-02-17 17:53:36 -08:00
custom_operator [BE] move more unittest.main() to run_tests() (#50923) 2021-01-25 07:23:09 -08:00
distributed Catch Flake8 error codes with multiple letters (#52750) 2021-02-24 12:56:12 -08:00
distributions Fix Dirichlet.arg_constraints event_dim (#51369) 2021-02-02 10:26:45 -08:00
error_messages
expect Trace linear as aten::linear (#51897) 2021-02-19 10:20:42 -08:00
fx Extend subgraph_rewriter logic (#51532) 2021-02-03 18:14:37 -08:00
jit [JIT] Allow __exit__ to have a return value (#52336) 2021-02-19 11:32:47 -08:00
jit_hooks [WIP] JIT Static Hooks: cpp tests (#49547) 2021-01-20 09:12:57 -08:00
mobile [pytorch] reintroduce static dispatch (#51957) 2021-02-19 11:41:39 -08:00
namespace_b torch.package - a way to package models and code (#45015) 2020-09-22 21:21:21 -07:00
onnx [ONNX] Update LayerNorm symbolic to handle autocasting (#52199) (#52350) 2021-02-19 10:57:15 -08:00
optim
package_a [fx/package] make GraphModules packageable (#51976) 2021-02-23 22:43:00 -08:00
quantization [quant] Reference option for conv module (#52316) 2021-02-24 14:54:02 -08:00
scripts
test_img [PyTorch Operator] [2/n] Adding python test 2020-06-25 18:36:44 -07:00
type_hint_tests Fix mypy type hint for AdaptiveAvgPool2,3d, AdaptiveMaxPool2,3d (#49963) 2021-01-06 09:47:15 -08:00
HowToWriteTestsUsingFileCheck.md Grammar patch 1 (.md) (#41599) 2020-07-20 10:19:08 -07:00
module_a.py torch.package - a way to package models and code (#45015) 2020-09-22 21:21:21 -07:00
run_test.py [Pytorch] Add python binding to use mobile cpu allocator. (#52323) 2021-02-17 08:42:23 -08:00
simulate_nccl_errors.py Remove py2 compatible future imports (#44735) 2020-09-16 12:55:57 -07:00
test_autograd.py Reenables skipped tests for all CUDA versions except 11.2 (#52359) 2021-02-19 15:30:55 -08:00
test_binary_ufuncs.py remove pointless test (#52609) 2021-02-22 16:25:04 -08:00
test_bundled_images.py Fixes lint (#40606) 2020-06-25 21:53:00 -07:00
test_bundled_inputs.py [Pytorch Mobile] Improve Bundled Inputs Error Checking (#52386) 2021-02-24 13:55:45 -08:00
test_complex.py Add serialization logic for complex numbers (#51287) 2021-01-28 17:25:35 -08:00
test_cpp_api_parity.py Always use NewModuleTest instead of ModuleTest. (#44745) 2020-09-17 07:36:39 -07:00
test_cpp_extensions_aot.py Test TORCH_LIBRARY in CUDA extension (#47524) 2020-11-16 13:12:22 -08:00
test_cpp_extensions_jit.py Internal gradcheck wrapper in testing._internal that sets certain flags to True (#51133) 2021-01-29 09:13:37 -08:00
test_cuda_primary_ctx.py Output to stderr in distributed tests. (#42139) 2020-07-29 19:23:34 -07:00
test_cuda.py fix torch.nn.parallel.scatter_gather.gather to handle NamedTuples and handle moving output to CPU (#51104) 2021-02-11 15:50:28 -08:00
test_dataloader.py Clean up usage of torch._six partially (#49785) 2021-02-08 13:58:34 -08:00
test_datapipe.py [DataLoader] TransformsIterDataPipe (#52604) 2021-02-23 15:47:27 -08:00
test_dataset.py [DataLoader] Rename Functional DataSet to DataPipe (#51488) 2021-02-03 07:01:09 -08:00
test_determination.py Add option for cpp_extensions to compile standalone executable (#47862) 2020-12-01 20:03:08 -08:00
test_dispatch.py Improve docs around Math/DefaultBackend & add PythonDispatcher class. (#50854) 2021-01-25 23:10:36 -08:00
test_expecttest.py [BE] replace unittest.main with run_tests (#50451) 2021-01-13 10:33:08 -08:00
test_foreach.py Revert D25074763: [WIP] Update foreach APIs to use scalar lists 2021-02-03 17:06:40 -08:00
test_function_schema.py Stricter backward compatibility check (#45773) 2020-10-06 01:28:48 -07:00
test_functional_autograd_benchmark.py Skip test_functional_autograd_benchmark during code coverage (#50183) 2021-01-07 11:17:21 -08:00
test_futures.py [JIT/Futures] support set_exception api (#50983) 2021-02-04 20:22:19 -08:00
test_fx_experimental.py [fx] Separate globals assignment from code generation (#51974) 2021-02-23 13:48:03 -08:00
test_fx.py [fx/package] make GraphModules packageable (#51976) 2021-02-23 22:43:00 -08:00
test_indexing.py index_put_ for complex tensors on CUDA (#51148) 2021-01-27 09:11:37 -08:00
test_jit_cuda_fuser.py [ROCm] disable tests for ROCm 4.0.1 (#51510) 2021-02-02 14:39:08 -08:00
test_jit_disabled.py [BE] replace unittest.main with run_tests (#50451) 2021-01-13 10:33:08 -08:00
test_jit_fuser_legacy.py Rename jobs and cli switches for testing GraphExecutor configurations to something a little bit more sensical. (#45715) 2020-10-05 11:43:28 -07:00
test_jit_fuser_te.py Add NNC support for aten::hardtanh (a hot operation in mobilenet v2/v3) (#52394) 2021-02-18 22:56:03 -08:00
test_jit_fuser.py Clean up some type annotations in caffe2/test (#49943) 2021-01-13 10:01:55 -08:00
test_jit_legacy.py Rename jobs and cli switches for testing GraphExecutor configurations to something a little bit more sensical. (#45715) 2020-10-05 11:43:28 -07:00
test_jit_profiling.py Remove redundant code for unsupported Python versions (#49486) 2021-01-06 12:45:46 -08:00
test_jit_py3.py Workaround Python3.9 limitations in test_jit_py3 (#51088) 2021-01-26 12:49:35 -08:00
test_jit_simple.py Remove redundant code for unsupported Python versions (#49486) 2021-01-06 12:45:46 -08:00
test_jit_string.py [JIT] Allow implicit boolean conversion of containers (#51683) 2021-02-05 00:34:35 -08:00
test_jit.py Ignore user annotated ignored attributes (#52367) 2021-02-23 10:40:44 -08:00
test_kernel_launch_checks.py Fix check_kernel_launches.py for macros and provide extended context (#49365) 2020-12-14 22:09:33 -08:00
test_license.py concantenate LICENSE files when building a wheel (#51634) 2021-02-08 08:28:46 -08:00
test_linalg.py Implemented torch.linalg.multi_dot (#51807) 2021-02-24 15:32:30 -08:00
test_logging.py
test_metal.py [Metal] Add the Python binding for optimize_for_mobile (#46456) 2020-10-17 10:26:25 -07:00
test_mkldnn.py add OneDNN pooling backward (#49454) 2021-02-23 14:45:55 -08:00
test_mobile_optimizer.py [Reland] Update XNNPACK (#52691) 2021-02-24 06:40:38 -08:00
test_multiprocessing_spawn.py Add exception classification to torch.multiprocessing.spawn (#45174) 2020-10-09 12:59:41 -07:00
test_multiprocessing.py [BE] unified run_process_no_exception code (#49774) 2021-01-04 13:43:09 -08:00
test_namedtensor.py Enhance Tensor.unflatten to support -1 as the inferred size (#51955) 2021-02-18 08:37:41 -08:00
test_namedtuple_return_api.py make forward AD API private (#51693) 2021-02-04 19:02:29 -08:00
test_native_functions.py Refactor scalar list APIs to use overloads (#45673) 2020-10-19 09:28:49 -07:00
test_nn.py Add 64bit indexing support for softmax (#52713) 2021-02-24 21:39:58 -08:00
test_numba_integration.py Drop unused imports from test (#49973) 2021-01-07 12:09:38 -08:00
test_numpy_interop.py Mypy fixes for pytorch master (#52090) 2021-02-17 10:39:51 -08:00
test_op_aliases.py OpInfo: Added clamp and trunc tests with aliases (#51167) 2021-02-10 05:36:18 -08:00
test_openmp.py Fix flaky test (#40175) 2020-06-17 15:40:28 -07:00
test_ops.py Add OpInfo entries for i0 and logical_not (#51956) 2021-02-23 10:12:05 -08:00
test_optim.py Reenables skipped tests for all CUDA versions except 11.2 (#52359) 2021-02-19 15:30:55 -08:00
test_overrides.py Fix pickling for Tensor subclasses (redo) (#47732) 2021-02-01 07:32:52 -08:00
test_package.py [fx/package] make GraphModules packageable (#51976) 2021-02-23 22:43:00 -08:00
test_profiler.py Add FLOPS support to the new profiler API. (#51734) 2021-02-05 15:03:35 -08:00
test_pruning_op.py Rowwise Prune op (Add the test to OSS run_test), Make the op private. (#46131) 2021-01-29 06:08:18 -08:00
test_pytree.py Implement _broadcast_to_and_flatten(pytree, spec) (#46288) 2020-10-20 07:52:14 -07:00
test_quantization.py NS for FX: add test for a simple sparsenn model (#52092) 2021-02-18 08:17:57 -08:00
test_reductions.py Enable min & max for Float16 & BFloat16 (#51244) 2021-02-18 23:13:51 -08:00
test_serialization.py Enable tests using named temp files on Windows (#49640) 2020-12-29 09:57:35 -08:00
test_set_default_mobile_cpu_allocator.py [Pytorch] Add python binding to use mobile cpu allocator. (#52323) 2021-02-17 08:42:23 -08:00
test_shape_ops.py Removes nonzero method warning (#51618) 2021-02-04 17:43:43 -08:00
test_show_pickle.py [BE] replace unittest.main with run_tests (#50451) 2021-01-13 10:33:08 -08:00
test_sort_and_select.py Stable sort for the CPU take 2. (#51790) 2021-02-19 09:28:57 -08:00
test_sparse.py [BE] _get_torch_cuda_version should return tuple (#52409) 2021-02-18 09:28:38 -08:00
test_spectral_ops.py [ROCm] enable fft tests (#51581) 2021-02-17 13:27:55 -08:00
test_static_runtime.py Clean up some type annotations in caffe2/test (#49943) 2021-01-13 10:01:55 -08:00
test_tensor_creation_ops.py [testing] Port torch.{repeat, tile} tests to use OpInfo machinery (#50199) 2021-01-19 06:02:27 -08:00
test_tensorboard.py Remove py2 compatible future imports (#44735) 2020-09-16 12:55:57 -07:00
test_tensorexpr_pybind.py Make te a hidden package for now (#51690) 2021-02-04 07:58:38 -08:00
test_tensorexpr.py Add NNC support for aten::hardtanh (a hot operation in mobilenet v2/v3) (#52394) 2021-02-18 22:56:03 -08:00
test_testing.py Add discontiguous kwarg to make_tensor (#51985) 2021-02-24 08:57:24 -08:00
test_throughput_benchmark.py Enable tests using named temp files on Windows (#49640) 2020-12-29 09:57:35 -08:00
test_torch.py remove index_fill side-effect for scalar tensors (#52209) 2021-02-25 00:35:27 -08:00
test_type_hints.py Mypy fixes for pytorch master (#52090) 2021-02-17 10:39:51 -08:00
test_type_info.py Improve repr for torch.iinfo & torch.finfo (#40488) 2020-07-10 15:22:55 -07:00
test_type_promotion.py [numpy] torch.erf{c} : promote integer inputs to float (#48472) 2020-11-27 15:08:40 -08:00
test_unary_ufuncs.py Add OpInfo entries for i0 and logical_not (#51956) 2021-02-23 10:12:05 -08:00
test_utils.py Re-enable test_standalone_load for Windows 11.1 (#51596) 2021-02-03 08:58:34 -08:00
test_view_ops.py Add tensor.view(dtype) (#47951) 2021-01-08 06:55:21 -08:00
test_vmap.py Add private mechanism to toggle vmap fallback warnings (#51218) 2021-01-28 13:05:00 -08:00
test_vulkan.py [vulkan] jit passes for vulkan conv2 prepack and fuse with clamp (#39282) 2020-06-20 14:12:21 -07:00
test_xnnpack_integration.py Mark top 3 slowest tests as slow (#46068) 2020-10-08 21:10:03 -07:00