Repository: pytorch
Issue: Failing periodic tests: test_dense_mask_index_cpu (__main__.CpuTests) & est_expanded_reduction_cpu (__main__.CpuTests)
Labels: triaged,module: flaky-tests

### 🐛 Describe the bug

The following two tests started failing periodic builds together
cuda11.6-py3.10-gcc7-sm86 / test (default, 4, 4, linux.g5.4xlarge.nvidia.gpu):
- test_dense_mask_index_cpu (__main__.CpuTests)
- est_expanded_reduction_cpu (__main__.CpuTests)


Logs showing the failing tests:
https://hud.pytorch.org/pytorch/pytorch/commit/a0c2a7f2eda788a48f1d243940297f1467faf138

Specifically, the failing tests are:

```
2022-10-16T05:48:45.7754229Z ======================================================================
2022-10-16T05:48:45.7754367Z FAIL [0.031s]: test_dense_mask_index_cpu (__main__.CpuTests)
2022-10-16T05:48:45.7754584Z ----------------------------------------------------------------------
2022-10-16T05:48:45.7754690Z Traceback (most recent call last):
2022-10-16T05:48:45.7754974Z   File "/var/lib/jenkins/workspace/test/inductor/test_torchinductor.py", line 3214, in test_dense_mask_index
2022-10-16T05:48:45.7755108Z     self.common(fn, [torch.randn(102400), torch.randn(3)])
2022-10-16T05:48:45.7755264Z   File "/opt/conda/lib/python3.10/unittest/mock.py", line 1369, in patched
2022-10-16T05:48:45.7755376Z     return func(*newargs, **newkeywargs)
2022-10-16T05:48:45.7755564Z   File "/var/lib/jenkins/workspace/test/inductor/test_torchinductor.py", line 256, in check_model
2022-10-16T05:48:45.7755652Z     self.assertEqual(
2022-10-16T05:48:45.7755940Z   File "/opt/conda/lib/python3.10/site-packages/torch/testing/_internal/common_utils.py", line 2472, in assertEqual
2022-10-16T05:48:45.7756023Z     assert_equal(
2022-10-16T05:48:45.7756287Z   File "/opt/conda/lib/python3.10/site-packages/torch/testing/_comparison.py", line 1093, in assert_equal
2022-10-16T05:48:45.7756392Z     raise error_metas[0].to_error(msg)
2022-10-16T05:48:45.7756505Z AssertionError: Scalars are not close!
2022-10-16T05:48:45.7756513Z 
2022-10-16T05:48:45.7756700Z Absolute difference: 0.0002899169921875 (up to 1e-05 allowed)
2022-10-16T05:48:45.7756900Z Relative difference: 1.3709022109477941e-06 (up to 1.3e-06 allowed)
2022-10-16T05:48:45.7756905Z 
2022-10-16T05:48:45.7757017Z ======================================================================
2022-10-16T05:48:45.7757162Z FAIL [0.026s]: test_expanded_reduction_cpu (__main__.CpuTests)
2022-10-16T05:48:45.7757369Z ----------------------------------------------------------------------
2022-10-16T05:48:45.7757465Z Traceback (most recent call last):
2022-10-16T05:48:45.7757662Z   File "/var/lib/jenkins/workspace/test/inductor/test_torchinductor.py", line 766, in test_expanded_reduction
2022-10-16T05:48:45.7757807Z     self.common(fn, (torch.randn(2, 197, 256), torch.randn(2, 1, 256)))
2022-10-16T05:48:45.7757959Z   File "/opt/conda/lib/python3.10/unittest/mock.py", line 1369, in patched
2022-10-16T05:48:45.7758070Z     return func(*newargs, **newkeywargs)
2022-10-16T05:48:45.7758305Z   File "/var/lib/jenkins/workspace/test/inductor/test_torchinductor.py", line 256, in check_model
2022-10-16T05:48:45.7758397Z     self.assertEqual(
2022-10-16T05:48:45.7758708Z   File "/opt/conda/lib/python3.10/site-packages/torch/testing/_internal/common_utils.py", line 2472, in assertEqual
2022-10-16T05:48:45.7758782Z     assert_equal(
2022-10-16T05:48:45.7759056Z   File "/opt/conda/lib/python3.10/site-packages/torch/testing/_comparison.py", line 1093, in assert_equal
2022-10-16T05:48:45.7759155Z     raise error_metas[0].to_error(msg)
2022-10-16T05:48:45.7759317Z AssertionError: Tensor-likes are not close!
2022-10-16T05:48:45.7759323Z 
2022-10-16T05:48:45.7759424Z Mismatched elements: 1 / 256 (0.4%)
2022-10-16T05:48:45.7759657Z Greatest absolute difference: 2.002716064453125e-05 at index (36,) (up to 1e-05 allowed)
2022-10-16T05:48:45.7759892Z Greatest relative difference: 4.907013266928203e-06 at index (36,) (up to 1.3e-06 allowed)
2022-10-16T05:48:45.7759903Z 
2022-10-16T05:48:45.7760111Z ----------------------------------------------------------------------
```

Probably unrelated, but the following test also started failing a few PRs later (tracked in https://github.com/pytorch/pytorch/issues/87089):

This test started failing a few PRs later
cuda11.6-py3.10-gcc7-sm86 / test (default, 1, 4, linux.g5.4xlarge.nvidia.gpu):
- test_comprehensive_masked_cumprod_cuda_float16 (__main__.TestInductorOpInfoCUDA) 


### Versions

n/a