@@ -1543,8 +1543,7 @@ def test_random_from_to_bool(self, device):
15431543 else :
15441544 self .assertRaisesRegex (
15451545 RuntimeError ,
1546- "random_ expects 'from' to be less than 'to', but got from=" + str (from_ ) + " >= to=" + str (
1547- to_ ),
1546+ "random_ expects 'from' to be less than 'to', but got from=" + str (from_ ) + " >= to=" + str (to_ ),
15481547 lambda : t .random_ (from_ , to_ )
15491548 )
15501549
@@ -1810,8 +1809,7 @@ def test_tensor_device(self, devices):
18101809 self .assertEqual ('cuda:1' ,
18111810 str (torch .tensor (5 , dtype = torch .int64 , device = 'cuda:1' ).device ))
18121811 self .assertEqual ('cuda:1' ,
1813- str (torch .tensor (torch .ones ((2 , 3 ), dtype = torch .float32 ),
1814- device = 'cuda:1' ).device ))
1812+ str (torch .tensor (torch .ones ((2 , 3 ), dtype = torch .float32 ), device = 'cuda:1' ).device ))
18151813
18161814 self .assertEqual ('cuda:1' ,
18171815 str (torch .tensor (np .random .randn (2 , 3 ), device = 'cuda:1' ).device ))
@@ -2043,8 +2041,7 @@ def test_tensor_factory(self, device):
20432041 float64_min = torch .finfo (torch .float64 ).min
20442042 g_1 = torch .tensor ((float ('nan' ), 0 , int64_min , int64_max , int64_min - 1 ), dtype = torch .bool )
20452043 self .assertEqual (e , g_1 )
2046- g_2 = torch .tensor ((int64_max + 1 , 0 , (int64_max + 1 ) * 2 , (int64_max + 1 ) * 2 + 1 , float64_min ),
2047- dtype = torch .bool )
2044+ g_2 = torch .tensor ((int64_max + 1 , 0 , (int64_max + 1 ) * 2 , (int64_max + 1 ) * 2 + 1 , float64_min ), dtype = torch .bool )
20482045 self .assertEqual (e , g_2 )
20492046 g_3 = torch .tensor ((float64_max , 0 , float64_max + 1 , float64_min - 1 , float64_max + 1e291 ), dtype = torch .bool )
20502047 self .assertEqual (e , g_3 )
@@ -2497,11 +2494,11 @@ def test_empty_tensor_props(self, device):
24972494 @onlyNativeDeviceTypes
24982495 def test_empty_overflow (self , device ):
24992496 with self .assertRaisesRegex (RuntimeError , 'Storage size calculation overflowed' ):
2500- torch .empty ([2 , 4 , 2 ** 29 , 2 ** 29 ], dtype = torch .float64 )
2497+ torch .empty ([2 , 4 , 2 ** 29 , 2 ** 29 ], dtype = torch .float64 )
25012498 with self .assertRaisesRegex (RuntimeError , 'Storage size calculation overflowed' ):
2502- torch .empty ([8 , 8 , 2 ** 29 , 2 ** 29 ], dtype = torch .float64 )
2499+ torch .empty ([8 , 8 , 2 ** 29 , 2 ** 29 ], dtype = torch .float64 )
25032500 with self .assertRaisesRegex (RuntimeError , 'Storage size calculation overflowed' ):
2504- torch .empty_strided ([8 , 8 ], [2 ** 61 , 1 ], dtype = torch .float64 )
2501+ torch .empty_strided ([8 , 8 ], [2 ** 61 , 1 ], dtype = torch .float64 )
25052502
25062503 def test_eye (self , device ):
25072504 for dtype in all_types_and_complex_and (torch .half , torch .bool , torch .bfloat16 ):
@@ -2542,7 +2539,7 @@ def test_linspace_vs_numpy(self, device, dtype):
25422539 start = - 0.0316082797944545745849609375 + (0.8888888888j if dtype .is_complex else 0 )
25432540 end = .0315315723419189453125 + (0.444444444444j if dtype .is_complex else 0 )
25442541
2545- for steps in [1 , 2 , 3 , 5 , 11 , 256 , 257 , 2 ** 22 ]:
2542+ for steps in [1 , 2 , 3 , 5 , 11 , 256 , 257 , 2 ** 22 ]:
25462543 t = torch .linspace (start , end , steps , device = device , dtype = dtype )
25472544 a = np .linspace (start , end , steps , dtype = torch_to_numpy_dtype_dict [dtype ])
25482545 t = t .cpu ()
@@ -2560,7 +2557,7 @@ def test_fn(torch_fn, numpy_fn, steps):
25602557 t = t .cpu ()
25612558 self .assertEqual (t , torch .from_numpy (a ))
25622559
2563- for steps in [1 , 2 , 3 , 5 , 11 , 256 , 257 , 2 ** 22 ]:
2560+ for steps in [1 , 2 , 3 , 5 , 11 , 256 , 257 , 2 ** 22 ]:
25642561 test_fn (torch .linspace , np .linspace , steps )
25652562
25662563 @dtypes (torch .complex64 )
0 commit comments