File tree Expand file tree Collapse file tree 2 files changed +15
-13
lines changed Expand file tree Collapse file tree 2 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -2367,19 +2367,6 @@ def test_isneginf_no_fallback(self):
2367
2367
t = t .to (torch .float16 )
2368
2368
self ._test_no_fallback (torch .isneginf , (t ,))
2369
2369
2370
- def test_uniform__raises_error_on_invalid_range (self ):
2371
- device = torch_xla .device ()
2372
- a = torch .empty (5 , 5 , device = device )
2373
- from_ = 5.
2374
- to_ = 2.
2375
-
2376
- try :
2377
- a .uniform_ (from_ , to_ )
2378
- except RuntimeError as e :
2379
- expected_error = (
2380
- "uniform_(): expected `from` (5) to be smaller or equal `to` (2)." )
2381
- self .assertEqual (str (e ), expected_error )
2382
-
2383
2370
2384
2371
class MNISTComparator (nn .Module ):
2385
2372
Original file line number Diff line number Diff line change @@ -222,6 +222,21 @@ def test():
222
222
expect = """roll(): expected `dims` [0] (size=1) to match the size of `shifts` [2, 2] (size=2)."""
223
223
)
224
224
225
+ def test_uniform__raises_error_on_invalid_range (self ):
226
+ device = torch_xla .device ()
227
+ a = torch .empty (5 , 5 , device = device )
228
+ from_ = 5.
229
+ to_ = 2.
230
+
231
+ def test ():
232
+ return a .uniform_ (from_ , to_ )
233
+
234
+ self .assertExpectedRaisesInline (
235
+ exc_type = RuntimeError ,
236
+ callable = test ,
237
+ expect = """uniform_(): expected `from` (5) to be smaller or equal `to` (2)."""
238
+ )
239
+
225
240
226
241
if __name__ == "__main__" :
227
242
unittest .main ()
You can’t perform that action at this time.
0 commit comments