Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

27 tests fail #9660

Open
yurivict opened this issue Sep 15, 2024 · 1 comment
Open

27 tests fail #9660

yurivict opened this issue Sep 15, 2024 · 1 comment

Comments

@yurivict
Copy link

🐛 Describe the bug

log

Versions

torch-geometric-2.6.0
pytorch-2.4.0
Python-3.11
FreeBSD 14.1

@yurivict
Copy link
Author

yurivict commented Nov 7, 2024

2.6.1 has: 17 failed, 5452 passed, 986 skipped, 12 warnings in 330.89s (0:05:30)

_____________________________________________________________________________ test_batching_with_new_dimension ______________________________________________________________________________

    def test_batching_with_new_dimension():
        torch_geometric.set_debug(True)
    
        class MyData(Data):
            def __cat_dim__(self, key, value, *args, **kwargs):
                if key == 'foo':
                    return None
                else:
                    return super().__cat_dim__(key, value, *args, **kwargs)
    
        x1 = torch.tensor([1, 2, 3], dtype=torch.float)
        foo1 = torch.randn(4)
        y1 = torch.tensor(1)
    
        x2 = torch.tensor([1, 2], dtype=torch.float)
        foo2 = torch.randn(4)
        y2 = torch.tensor(2)
    
        batch = Batch.from_data_list(
            [MyData(x=x1, foo=foo1, y=y1),
             MyData(x=x2, foo=foo2, y=y2)])
    
        assert str(batch) == ('MyDataBatch(x=[5], y=[2], foo=[2, 4], batch=[5], '
                              'ptr=[3])')
        assert batch.num_graphs == len(batch) == 2
        assert batch.x.tolist() == [1, 2, 3, 1, 2]
        assert batch.foo.size() == (2, 4)
        assert batch.foo[0].tolist() == foo1.tolist()
        assert batch.foo[1].tolist() == foo2.tolist()
        assert batch.y.tolist() == [1, 2]
        assert batch.batch.tolist() == [0, 0, 0, 1, 1]
        assert batch.ptr.tolist() == [0, 3, 5]
        assert batch.num_graphs == 2
    
        data = batch[0]
>       assert str(data) == ('MyData(x=[3], y=[1], foo=[4])')
E       AssertionError: assert 'MyData(x=[3]..., foo=[1, 4])' == 'MyData(x=[3]...[1], foo=[4])'
E         
E         - MyData(x=[3], y=[1], foo=[4])
E         + MyData(x=[3], y=[1], foo=[1, 4])
E         ?                           +++

test/data/test_batch.py:314: AssertionError
===================================================================================== warnings summary ======================================================================================

_____________________________________________________________________________ test_batching_with_new_dimension ______________________________________________________________________________

    def test_batching_with_new_dimension():
        torch_geometric.set_debug(True)
    
        class MyData(Data):
            def __cat_dim__(self, key, value, *args, **kwargs):
                if key == 'foo':
                    return None
                else:
                    return super().__cat_dim__(key, value, *args, **kwargs)
    
        x1 = torch.tensor([1, 2, 3], dtype=torch.float)
        foo1 = torch.randn(4)
        y1 = torch.tensor(1)
    
        x2 = torch.tensor([1, 2], dtype=torch.float)
        foo2 = torch.randn(4)
        y2 = torch.tensor(2)
    
        batch = Batch.from_data_list(
            [MyData(x=x1, foo=foo1, y=y1),
             MyData(x=x2, foo=foo2, y=y2)])
    
        assert str(batch) == ('MyDataBatch(x=[5], y=[2], foo=[2, 4], batch=[5], '
                              'ptr=[3])')
        assert batch.num_graphs == len(batch) == 2
        assert batch.x.tolist() == [1, 2, 3, 1, 2]
        assert batch.foo.size() == (2, 4)
        assert batch.foo[0].tolist() == foo1.tolist()
        assert batch.foo[1].tolist() == foo2.tolist()
        assert batch.y.tolist() == [1, 2]
        assert batch.batch.tolist() == [0, 0, 0, 1, 1]
        assert batch.ptr.tolist() == [0, 3, 5]
        assert batch.num_graphs == 2
    
        data = batch[0]
>       assert str(data) == ('MyData(x=[3], y=[1], foo=[4])')
E       AssertionError: assert 'MyData(x=[3]..., foo=[1, 4])' == 'MyData(x=[3]...[1], foo=[4])'
E         
E         - MyData(x=[3], y=[1], foo=[4])
E         + MyData(x=[3], y=[1], foo=[1, 4])
E         ?                           +++

test/data/test_batch.py:314: AssertionError
===================================================================================== warnings summary ======================================================================================


_________________________________________________________________________ test_traceable_my_conv_with_self_loops[0] _________________________________________________________________________

num_nodes = 0

    @pytest.mark.parametrize('num_nodes', [4, 8, 2, 0])
    def test_traceable_my_conv_with_self_loops(num_nodes):
        # `torch.jit.trace` a `MessagePassing` layer that adds self loops and test
        # it across different input sizes.
        x = torch.randn(4, 16)
        edge_index = torch.tensor([[0, 1, 1, 2, 2, 3], [1, 0, 2, 1, 3, 2]])
    
        conv = MyConvWithSelfLoops()
>       traced_conv = torch.jit.trace(conv, ((x, edge_index)))

test/nn/conv/test_message_passing.py:713: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.11/site-packages/torch/jit/_trace.py:1000: in trace
    traced_func = _trace_impl(
/usr/local/lib/python3.11/site-packages/torch/jit/_trace.py:695: in _trace_impl
    return trace_module(
/usr/local/lib/python3.11/site-packages/torch/jit/_trace.py:1303: in trace_module
    _check_trace(
/usr/local/lib/python3.11/site-packages/torch/utils/_contextlib.py:116: in decorate_context
    return func(*args, **kwargs)
/usr/local/lib/python3.11/site-packages/torch/jit/_trace.py:592: in _check_trace
    diag_info = graph_diagnostic_info()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def graph_diagnostic_info():
        mod_canonicalized = torch._C._jit_pass_canonicalize(traced_func.graph)
        torch._C._jit_pass_inline(mod_canonicalized)
        torch._C._jit_pass_erase_shape_information(mod_canonicalized)
        mod_str = str(mod_canonicalized)
        mod_str = re.sub(r"___torch_mangle_[0-9]+\.", "", mod_str)
        check_canonicalized = torch._C._jit_pass_canonicalize(check_mod_func.graph)
        torch._C._jit_pass_inline(check_canonicalized)
        torch._C._jit_pass_erase_shape_information(check_canonicalized)
        check_str = str(check_canonicalized)
        check_str = re.sub(r"___torch_mangle_[0-9]+\.", "", check_str)
    
        graph_diff_errors = None
        if mod_str != check_str:
            import difflib
    
            graph_diff = difflib.ndiff(
                mod_str.splitlines(True), check_str.splitlines(True)
            )
            graph_diff_errors = "Graph diff:\n" + indent("".join(graph_diff)) + "\n"
    
            for n_mod, n_check in zip(
                mod_canonicalized.nodes(), check_canonicalized.nodes()
            ):
                if str(n_mod) != str(n_check):
                    graph_diff_errors += "First diverging operator:\n"
                    node_diff = difflib.ndiff(
                        str(n_mod).splitlines(True), str(n_check).splitlines(True)
                    )
                    source_printout = (
                        "Node diff:\n" + indent("".join(node_diff)) + "\n"
                    )
                    mod_stack = n_mod.sourceRange()
                    if mod_stack:
                        source_printout += (
                            "Trace source location:\n" + indent(mod_stack) + "\n"
                        )
                    check_stack = n_check.sourceRange()
                    if check_stack:
                        source_printout += (
                            "Check source location:\n" + indent(check_stack) + "\n"
                        )
                    graph_diff_errors += source_printout
    
                    break  # For now, only print out the first pair of nodes that diverges
    
        tensor_compare_errors = None
        # Check Tensor-valued constant nodes
        for n_mod, n_check in zip(
            mod_canonicalized.nodes(), check_canonicalized.nodes()
        ):
            if n_mod.kind() != n_check.kind():
                break  # Graphs have already diverged
    
            if n_mod.kind() == "prim::Constant" and not (
                n_mod.mustBeNone() or n_check.mustBeNone()
            ):
                if not n_mod.hasAttribute("value"):
                    continue
                if n_mod.kindOf("value") != "t" or n_check.kindOf("value") != "t":
                    continue
    
>               mod_tensor_val = n_mod.t("value")
E               RuntimeError: required keyword attribute 'value' has the wrong type

/usr/local/lib/python3.11/site-packages/torch/jit/_trace.py:447: RuntimeError

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants