torch_npu.npu.matmul.allow_hf32功能和调用方式与torch.backends.cuda.matmul.allow_tf32类似,torch.backends.cuda.matmul.allow_tf32的功能具体请参考https://pytorch.org/docs/stable/backends.html#torch.backends.cuda.matmul.allow_tf32。
torch_npu.npu.matmul.allow_hf32的调用方式如下所示:
torch_npu.npu.matmul.allow_hf32 = bool
matmul类算子开启支持hf32类型能力。
输入bool值,默认值False。
bool类型。
Atlas A2 训练系列产品
def test_matmul_allow_hf32(self): res = torch.npu.matmul.allow_hf32 self.assertEqual(res, False) torch.npu.matmul.allow_hf32 = True res = torch.npu.matmul.allow_hf32 self.assertEqual(res, True) torch.npu.matmul.allow_hf32 = False res = torch.npu.matmul.allow_hf32 self.assertEqual(res, False)