mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
as title Differential Revision: [D52924188](https://our.internmc.facebook.com/intern/diff/D52924188/) Pull Request resolved: https://github.com/pytorch/pytorch/pull/117886 Approved by: https://github.com/ydwu4
32 lines
986 B
Python
32 lines
986 B
Python
# Owner(s): ["oncall: export"]
|
|
import torch
|
|
from torch.testing._internal.common_utils import run_tests, TestCase
|
|
|
|
|
|
class TestFuntionalAssertions(TestCase):
|
|
def test_functional_assert_async_msg(self) -> None:
|
|
dep_token = torch.ops.aten._make_dep_token()
|
|
self.assertEqual(
|
|
torch.ops.aten._functional_assert_async.msg(
|
|
torch.tensor(1), "test msg", dep_token
|
|
),
|
|
dep_token,
|
|
)
|
|
with self.assertRaisesRegex(RuntimeError, "test msg"):
|
|
torch.ops.aten._functional_assert_async.msg(
|
|
torch.tensor(0), "test msg", dep_token
|
|
),
|
|
|
|
def test_functional_sym_constrain_range(self) -> None:
|
|
dep_token = torch.ops.aten._make_dep_token()
|
|
self.assertEqual(
|
|
torch.ops.aten._functional_sym_constrain_range(
|
|
3, min=2, max=5, dep_token=dep_token
|
|
),
|
|
dep_token,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
run_tests()
|