beta)torch_npu.npu.utils.is_support_inf_nan

接口原型

torch_npu.npu.utils.is_support_inf_nan() -> bool

功能描述

判断当前使用的溢出检测模式,True为INF_NAN模式,False为饱和模式。

输出说明

True为INF_NAN模式,False为饱和模式。

支持的型号

调用示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
import torch
 
import torch_npu.npu.utils as utils
from torch_npu.testing.testcase import TestCase, run_tests
 
 
class TestCheckOverFlow(TestCase):
 
    def test_check_over_flow(self):
        ret = utils.is_support_inf_nan()
        self.assertTrue(ret)
 
 
if __name__ == "__main__":
    run_tests()