test_linspace : remove explicit for-loop (#38191)
Summary:
Reference : https://github.com/pytorch/pytorch/issues/38187
Benchmark with same build settings on same system.
gcc : version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
CPU : Intel® Core i5-8300H CPU @ 2.30GHz × 8
GPU : GTX 1050ti
Test Cmd : `pytest test/test_torch.py -k linspace_cpu_float`
Before :
```
test/test_torch.py .. [100%]
======================================================================== 2 passed, 5170 deselected in 24.43s ========================================================================
```
After :
```
test/test_torch.py .. [100%]
======================================================================== 2 passed, 5170 deselected in 9.20s =========================================================================
```
Test Cmd : `pytest test/test_torch.py -k linspace_cuda_float`
Before :
```
test/test_torch.py ...... [100%]
=================================================================== 6 passed, 5166 deselected in 83.84s (0:01:23) ===================================================================
```
After :
```
test/test_torch.py ...... [100%]
======================================================================== 6 passed, 5166 deselected in 40.18s ========================================================================
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/38191
Differential Revision: D21494478
Pulled By: mruberry
fbshipit-source-id: fa58f727781425937a7b8212f9b63a739935eb86