Skip to content

test_correctness_abs_float64 - AssertionError: Tensor-likes are not close! #4852

@rdspring1

Description

@rdspring1

Isolated to commit a70e0f5 from

CMD

pytest tests/python/opinfo/test_legacy_ops.py -k test_correctness_abs

Error Trace

tests/python/opinfo/test_legacy_ops.py:223: in test_correctness
    return serde_test_fn(op, dtype)
python/nvfuser/pytorch_utils.py:169: in retried_func
    output = func(*args, **kwargs)
tests/python/opinfo/test_legacy_ops.py:214: in serde_test_fn
    result = correctness_test_fn(op.reference_type, op, sample)
tests/python/opinfo/test_legacy_ops.py:198: in correctness_test_fn
    return torch_correctness_test_fn(_fd_fn, nvf_op, sample)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fd_fn = <function default_fd_fn at 0xfe7adc7c5940>
nvf_op = OpInfo(op=<function <lambda> at 0xfe789ba33060>, name='abs', domain=Domain(low=None, high=None), dtypes=(torch.int32, ...erence_type=<ReferenceType.Pytorch: 0>, symbolic_parameter_list=None, is_clonable=True, supports_direct_bindings=False)
sample = [SampleInput args=(tensor([-5.0100e+02,  5.0100e+02, -1.0012e+03,  1.0012e+03, -1.3438e+04,
         1.3438e+04, -4.9884e+06,  4.9884e+06, -1.0000e+20,  1.0000e+20],
       device='cuda:0', dtype=torch.float64),) kwargs={}]

    def torch_correctness_test_fn(fd_fn: Callable, nvf_op: OpInfo, sample: SampleInput):
        with FusionDefinition() as fd:
            fd_fn(fd, nvf_op, *sample.args, **sample.kwargs)
        inputs = parse_args_fusion_execution(nvf_op, *sample.args)
        inputs_cap = deepcopy(inputs)
        nvfuser_result = fd.execute(inputs)
        assert check_captured_python_definition(nvfuser_result, fd, inputs_cap)
    
        if nvf_op.is_clonable:
            assert check_cpp_translation(
                nvfuser_result, fd, inputs_cap, supports_segmentation=True
            )
    
        torch_result = nvf_op.reference(*sample.args, **sample.kwargs)
    
        if isinstance(nvfuser_result, Exception):
            raise nvfuser_result
    
        if len(nvfuser_result) == 1:
            nvfuser_result = nvfuser_result[0]
    
        # TODO If dtype is fp16 or bf16, skip dtype check because nvfuser promotes
        # to fp32 but does not return original dtype.
        # TODO Add specific dtype tolerances
>       torch.testing.assert_close(
            nvfuser_result, torch_result, equal_nan=True, atol=1e-3, rtol=0
        )
E       AssertionError: Tensor-likes are not close!
E       
E       Mismatched elements: 4 / 10 (40.0%)
E       Greatest absolute difference: 2004087734272.0 at index (8,) (up to 0.001 allowed)
E       Greatest relative difference: 4.0092781147673603e-08 at index (6,) (up to 0 allowed)

tests/python/opinfo/test_legacy_ops.py:111: AssertionError

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions