Closed
[Bug-Report|缺陷反馈]: Remainder算子在A2/A3上未默认走到低精度模式 #3828
刘奕哲Add on  15 days agoClosed at  2 days ago
刘奕哲
刘奕哲
15 days ago Create

Describe the current behavior / 问题描述 (Mandatory / 必填)

Remainder算子在A2/A3上未默认走到低精度模式

Environment / 环境信息 (Mandatory / 必填)

A2/A3
cann-9.3.0
11月13日12时的pypto和pto-isa

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

执行pypto库上用例pypto/python/tests/st/operation/vector/test_remainder_onboard.py

Describe the expected behavior / 预期结果 (Mandatory / 必填)

pass

actual = [tensor([[ 5.7750e+01,  2.8125e+01,  8.7500e+00,  ...,  1.6000e+01,
          2.9375e+00,  1.0625e+01],
        [ 3.75...4.8250e+01, -1.3750e+00,  ..., -1.2000e+01,
         -6.2500e+01, -3.5000e+00]], device='npu:2', dtype=torch.bfloat16)]
expected = [tensor([[ -3.0000, -12.7500, -19.0000,  ..., -32.5000, -42.2500, -50.0000],
        [ -4.5000,  -8.5000, -15.0000,  ....,  -2.1250],
        [ -1.5000, -48.2500,  -1.3750,  ..., -12.0000, -62.5000,  -3.5000]],
       dtype=torch.bfloat16)]

    def assert_outputs(actual: list[torch.Tensor], expected: list[torch.Tensor]) -> None:
        assert len(actual) == len(expected)
        for actual_tensor, expected_tensor in zip(actual, expected):
            actual_cpu = actual_tensor.cpu()
            expected_cpu = expected_tensor.to(actual_cpu.dtype).cpu()
            if not actual_cpu.is_floating_point():
                assert torch.equal(actual_cpu, expected_cpu)
                continue
            tolerance = 1e-2 if actual_cpu.dtype in {torch.float16, torch.bfloat16} else 5e-3
>           assert torch.allclose(actual_cpu, expected_cpu, rtol=tolerance, atol=tolerance, equal_nan=True)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           AssertionError

../pypto/python/tests/st/operation/vector/vector_test_utils.py:60: AssertionError

Special notes for this issue/备注 (Optional / 选填)

likedislike
刘奕哲
刘奕哲
15 days ago Comments:

/assign

likedislike
CANN-robotCANN-robotCollaborators
15 days ago Assign Creeeeper as responsible person
刘奕哲刘奕哲
15 days ago Associated pull request
刘奕哲刘奕哲
15 days ago Associated pull request
刘奕哲
刘奕哲
12 days ago Comments:

已解决,可关闭

likedislike
刘奕哲刘奕哲
2 days ago changed custom state from 待办的 to 已解决
刘奕哲刘奕哲
2 days ago Close issue