xref: /aosp_15_r20/external/pytorch/test/functorch/test_logging.py (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1# Owner(s): ["module: dynamo"]
2import logging
3
4import torch
5from torch._functorch.aot_autograd import aot_function
6from torch._functorch.compilers import nop
7from torch.testing._internal.common_utils import run_tests
8from torch.testing._internal.logging_utils import LoggingTestCase, make_logging_test
9
10
11class TestAOTLogging(LoggingTestCase):
12    @make_logging_test(aot=logging.DEBUG)
13    def test_logging(self, records):
14        def f(x):
15            return torch.sin(x)
16
17        compiled_f = aot_function(f, fw_compiler=nop, bw_compiler=nop)
18        compiled_f(torch.randn(3))
19        self.assertGreater(len(records), 0)
20
21
22if __name__ == "__main__":
23    run_tests()
24