remove rouge raise in helper function (#58914)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/58914
Only the top-level functions `assert_(equal|close)` should raise the
exception to keep the traceback managable.
Test Plan: Imported from OSS
Reviewed By: anjali411
Differential Revision: D29259408
Pulled By: mruberry
fbshipit-source-id: 40dd52eec6f9e8166b3b239d5172ee44b749e8dc
diff --git a/torch/testing/_asserts.py b/torch/testing/_asserts.py
index 7979efb..0acae8a 100644
--- a/torch/testing/_asserts.py
+++ b/torch/testing/_asserts.py
@@ -401,7 +401,7 @@
actual, expected, check_device=check_device, check_dtype=check_dtype, check_stride=check_stride
)
if exc:
- raise exc
+ return exc
actual, expected = _equalize_attributes(actual, expected)
if (rtol == 0.0) and (atol == 0.0):