pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
21.5k stars 3.69k forks source link

tests failed #8460

Closed beew closed 11 months ago

beew commented 1 year ago

🐛 Describe the bug

After installing pytorch_geometric I ran the tests and got a lot of failures for some tests.

There are these

================================== FAILURES ===================================
_________________ test_pyg_lib_and_torch_sparse_homo_equality __________________

    @withPackage('pyg_lib', 'torch_sparse')
    def test_pyg_lib_and_torch_sparse_homo_equality():
        edge_index = get_random_edge_index(20, 20, 100)
        adj = to_torch_csr_tensor(edge_index.flip([0]), size=(20, 20))
        colptr, row = adj.crow_indices(), adj.col_indices()

        seed = torch.arange(10)

        sample = torch.ops.pyg.neighbor_sample
        out1 = sample(colptr, row, seed, [-1, -1], None, None, None, True)
        sample = torch.ops.torch_sparse.neighbor_sample
        out2 = sample(colptr, row, seed, [-1, -1], False, True)

        row1, col1, node_id1, edge_id1 = out1[:4]
        node_id2, row2, col2, edge_id2 = out2
        assert torch.equal(node_id1, node_id2)
>       assert torch.equal(row1, row2)
E       assert False
E        +  where False = <built-in method equal of type object at 0x7f81b2330e20>(tensor([ 0,  0,  0,  0,  1,  1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  3,  4,\n         4,  4,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  7,  7,  7,  7,  7,  8,\n         8,  8,  8,  8,  8,  9,  9,  9,  9, 10, 10, 10, 10, 10, 10, 11, 11, 11,\n        11, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16,\n        16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 18, 18]), tensor([ 0,  8, 10, 11,  3,  6,  7, 12, 13,  2,  7, 14, 15,  4, 10, 16, 15,  1,\n         2,  5, 17, 12, 15, 11,  3,  4,  7, 11,  1,  4,  3,  8, 10, 14, 11,  3,\n         4,  8, 17, 13, 18,  2,  4,  7, 17,  0,  2, 17, 12, 16, 13, 10, 12, 15,\n        18,  7,  9,  0,  6, 10, 12, 11, 16, 13, 11, 18,  2,  4,  5, 18,  5,  7,\n        17, 14, 18,  9, 16, 11,  3,  8,  9, 16, 15, 18]))
E        +    where <built-in method equal of type object at 0x7f81b2330e20> = torch.equal

test/loader/test_neighbor_loader.py:540: AssertionError
________________ test_pyg_lib_and_torch_sparse_hetero_equality _________________

    @withPackage('pyg_lib', 'torch_sparse')
    def test_pyg_lib_and_torch_sparse_hetero_equality():
        edge_index = get_random_edge_index(20, 10, 50)
        adj = to_torch_csr_tensor(edge_index.flip([0]), size=(10, 20))
        colptr1, row1 = adj.crow_indices(), adj.col_indices()

        edge_index = get_random_edge_index(10, 20, 50)
        adj = to_torch_csr_tensor(edge_index.flip([0]), size=(20, 10))
        colptr2, row2 = adj.crow_indices(), adj.col_indices()

        node_types = ['paper', 'author']
        edge_types = [('paper', 'to', 'author'), ('author', 'to', 'paper')]
        colptr_dict = {
            'paper__to__author': colptr1,
            'author__to__paper': colptr2,
        }
        row_dict = {
            'paper__to__author': row1,
            'author__to__paper': row2,
        }
        seed_dict = {'paper': torch.arange(1)}
        num_neighbors_dict = {
            'paper__to__author': [-1, -1],
            'author__to__paper': [-1, -1],
        }

        sample = torch.ops.pyg.hetero_neighbor_sample
>       out1 = sample(node_types, edge_types, colptr_dict, row_dict, seed_dict,
                      num_neighbors_dict, None, None, None, True, False, True,
                      False, "uniform", True)

test/loader/test_neighbor_loader.py:572: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <OpOverloadPacket(op='pyg.hetero_neighbor_sample')>
args = (['paper', 'author'], [('paper', 'to', 'author'), ('author', 'to', 'paper')], {'author__to__paper': tensor([ 0,  3,  8... 8, 15, 17, 19,  8, 14])}, {'paper': tensor([0])}, {'author__to__paper': [-1, -1], 'paper__to__author': [-1, -1]}, ...)
kwargs = {}

    def __call__(self, *args, **kwargs):
        # overloading __call__ to ensure torch.ops.foo.bar()
        # is still callable from JIT
        # We save the function ptr as the `op` attribute on
        # OpOverloadPacket to access it here.
>       return self._op(*args, **kwargs or {})
E       RuntimeError: pyg::hetero_neighbor_sample() expected at most 14 argument(s) but received 15 argument(s). Declaration: pyg::hetero_neighbor_sample(str[] node_types, (str, str, str)[] edge_types, Dict(str, Tensor) rowptr_dict, Dict(str, Tensor) col_dict, Dict(str, Tensor) seed_dict, Dict(str, int[]) num_neighbors_dict, Dict(str, Tensor)? time_dict=None, Dict(str, Tensor)? seed_time_dict=None, bool csc=False, bool replace=False, bool directed=True, bool disjoint=False, str temporal_strategy="uniform", bool return_edge_id=True) -> (Dict(str, Tensor), Dict(str, Tensor), Dict(str, Tensor), Dict(str, Tensor)?, Dict(str, int[]), Dict(str, int[]))

../../lib/python3.10/site-packages/torch/_ops.py:502: RuntimeError
________________________ test_index_select_out_of_range ________________________

    def test_index_select_out_of_range():
        with pytest.raises(IndexError, match="out of range"):
>           index_select(torch.randn(3, 5), torch.tensor([0, 2, 3]))

test/loader/test_utils.py:16: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

value = tensor([[ 0.9994,  0.1966,  0.1530,  1.1206, -0.4225],
        [ 1.7494,  0.4751,  0.0236, -0.0791, -1.5103],
        [ 1.2039, -2.7800,  0.6247, -0.5723,  0.4597]])
index = tensor([0, 2, 3]), dim = 0

    def index_select(
        value: FeatureTensorType,
        index: Tensor,
        dim: int = 0,
    ) -> Tensor:
        r"""Indexes the :obj:`value` tensor along dimension :obj:`dim` using the
        entries in :obj:`index`.

        Args:
            value (torch.Tensor or np.ndarray): The input tensor.
            index (torch.Tensor): The 1-D tensor containing the indices to index.
            dim (int, optional): The dimension in which to index.
                (default: :obj:`0`)

        .. warning::

            :obj:`index` is casted to a :obj:`torch.int64` tensor internally, as
            `PyTorch currently only supports indexing
            <https://github.com/pytorch/pytorch/issues/61819>`_ via
            :obj:`torch.int64`.
        """
        # PyTorch currently only supports indexing via `torch.int64`:
        # https://github.com/pytorch/pytorch/issues/61819
        index = index.to(torch.int64)

        if isinstance(value, Tensor):
            out: Optional[Tensor] = None
            if torch.utils.data.get_worker_info() is not None:
                # If we are in a background process, we write directly into a
                # shared memory tensor to avoid an extra copy:
                size = list(value.shape)
                size[dim] = index.numel()
                numel = math.prod(size)
                if torch_geometric.typing.WITH_PT20:
                    storage = value.untyped_storage()._new_shared(
                        numel * value.element_size())
                else:
                    storage = value.storage()._new_shared(numel)
                out = value.new(storage).view(size)

>           return torch.index_select(value, dim, index, out=out)
E           RuntimeError: INDICES element is out of DATA bounds, id=3 axis_dim=3

../../lib/python3.10/site-packages/torch_geometric/loader/utils.py:73: RuntimeError
=============================== warnings summary ===============================
../../lib/python3.10/site-packages/torch/utils/tensorboard/__init__.py:4
  /home/bernard/opt/python310/lib/python3.10/site-packages/torch/utils/tensorboard/__init__.py:4: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if not hasattr(tensorboard, "__version__") or LooseVersion(

../../lib/python3.10/site-packages/torch/utils/tensorboard/__init__.py:6
  /home/bernard/opt/python310/lib/python3.10/site-packages/torch/utils/tensorboard/__init__.py:6: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    ) < LooseVersion("1.15"):

../../lib/python3.10/site-packages/torch_geometric/contrib/__init__.py:8
  /home/bernard/opt/python310/lib/python3.10/site-packages/torch_geometric/contrib/__init__.py:8: UserWarning: 'torch_geometric.contrib' contains experimental code and is subject to change. Please use with caution.
    warnings.warn(

test/data/test_batch.py::test_torch_sparse_batch[layout0]
  /home/bernard/opt/python310/Examples/pytorch_geometric/test/data/test_batch.py:517: UserWarning: Sparse CSR tensor support is in beta state. If you miss a functionality in the sparse tensor support, please submit a feature request to https://github.com/pytorch/pytorch/issues. (Triggered internally at ../aten/src/ATen/SparseCsrTensorImpl.cpp:54.)
    out = to_edge_index(batch.adj.to_sparse(layout=torch.sparse_csr))

test/data/test_batch.py::test_torch_nested_batch
  /home/bernard/opt/python310/Examples/pytorch_geometric/test/data/test_batch.py:530: UserWarning: The PyTorch API of nested tensors is in prototype stage and will change in the near future. (Triggered internally at ../aten/src/ATen/NestedTensorImpl.cpp:177.)
    x1 = nested_tensor([torch.randn(3), torch.randn(4)])

test/explain/algorithm/test_captum.py: 6 warnings
test/explain/algorithm/test_captum_explainer.py: 40 warnings
test/explain/algorithm/test_captum_hetero.py: 6 warnings
  /home/bernard/opt/python310/lib/python3.10/site-packages/captum/attr/_core/guided_backprop_deconvnet.py:64: UserWarning: Setting backward hooks on ReLU activations.The hooks will be removed after the attribution is finished
    warnings.warn(

test/explain/algorithm/test_captum_explainer.py: 56 warnings
test/explain/algorithm/test_captum_hetero.py: 8 warnings
  /home/bernard/opt/python310/lib/python3.10/site-packages/captum/_utils/gradient.py:57: UserWarning: Input Tensor 0 did not already require gradients, required_grads has been set automatically.
    warnings.warn(

test/explain/algorithm/test_captum_explainer.py: 8 warnings
test/explain/algorithm/test_captum_hetero.py: 8 warnings
  /home/bernard/opt/python310/lib/python3.10/site-packages/captum/_utils/gradient.py:57: UserWarning: Input Tensor 1 did not already require gradients, required_grads has been set automatically.
    warnings.warn(

test/nn/dense/test_linear.py::test_hetero_linear[device0]
  /home/bernard/opt/python310/lib/python3.10/site-packages/torch/jit/_check.py:172: UserWarning: The TorchScript type system doesn't support instance-level annotations on empty non-base types in `__init__`. Instead, either 1) use a type annotation in the class body, or 2) wrap the type in `torch.jit.Attribute`.
    warnings.warn("The TorchScript type system doesn't support "

test/transforms/test_node_property_split.py::test_node_property_split[popularity]
test/transforms/test_node_property_split.py::test_node_property_split[locality]
test/transforms/test_node_property_split.py::test_node_property_split[locality]
  /home/bernard/opt/python310/lib/python3.10/site-packages/networkx/algorithms/link_analysis/pagerank_alg.py:108: DeprecationWarning: networkx.pagerank_scipy is deprecated and will be removed in NetworkX 3.0, use networkx.pagerank instead.
    return pagerank_scipy(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated Nunit xml file: /home/bernard/opt/python310/Examples/pytorch_geometric/test-output.xml -
=========================== short test summary info ============================
FAILED test/loader/test_neighbor_loader.py::test_pyg_lib_and_torch_sparse_homo_equality - assert False
FAILED test/loader/test_neighbor_loader.py::test_pyg_lib_and_torch_sparse_hetero_equality - RuntimeError: pyg::hetero_neighbor_sample() expected at most 14 argument(s)...
FAILED test/loader/test_utils.py::test_index_select_out_of_range - RuntimeError: INDICES element is out of DATA bounds, id=3 axis_dim=3

But a lot more are from test/explain/algorithm/test_graphmask_explainer.py. They are all like this

========================== short test summary info ============================
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-node-model-MaskType.object-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-node-model-MaskType.object-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-node-model-MaskType.common_attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-node-model-MaskType.common_attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-node-model-MaskType.attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-node-model-MaskType.attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-node-phenomenon-MaskType.object-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-node-phenomenon-MaskType.object-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-node-phenomenon-MaskType.common_attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-node-phenomenon-MaskType.common_attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-node-phenomenon-MaskType.attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-node-phenomenon-MaskType.attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-edge-model-MaskType.object-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-edge-model-MaskType.object-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-edge-model-MaskType.common_attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-edge-model-MaskType.common_attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-edge-model-MaskType.attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-edge-model-MaskType.attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-edge-phenomenon-MaskType.object-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-edge-phenomenon-MaskType.object-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-edge-phenomenon-MaskType.common_attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-edge-phenomenon-MaskType.common_attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-edge-phenomenon-MaskType.attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-edge-phenomenon-MaskType.attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-graph-model-MaskType.object-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-graph-model-MaskType.object-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-graph-model-MaskType.common_attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-graph-model-MaskType.common_attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-graph-model-MaskType.attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-graph-model-MaskType.attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-graph-phenomenon-MaskType.object-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-graph-phenomenon-MaskType.object-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-graph-phenomenon-MaskType.common_attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-graph-phenomenon-MaskType.common_attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-graph-phenomenon-MaskType.attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-probs-graph-phenomenon-MaskType.attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-node-model-MaskType.object-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-node-model-MaskType.object-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-node-model-MaskType.common_attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-node-model-MaskType.common_attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-node-model-MaskType.attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-node-model-MaskType.attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-node-phenomenon-MaskType.object-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-node-phenomenon-MaskType.object-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-node-phenomenon-MaskType.common_attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-node-phenomenon-MaskType.common_attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-node-phenomenon-MaskType.attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-node-phenomenon-MaskType.attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-edge-model-MaskType.object-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-edge-model-MaskType.object-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-edge-model-MaskType.common_attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-edge-model-MaskType.common_attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-edge-model-MaskType.attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-edge-model-MaskType.attributes-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-edge-phenomenon-MaskType.object-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-edge-phenomenon-MaskType.object-None] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...
FAILED test/explain/algorithm/test_graphmask_explainer.py::test_graph_mask_explainer_binary_classification[None-raw-edge-phenomenon-MaskType.common_attributes-MaskType.object] - IndexError: Dimension out of range (expected to be in range of [-2, 1], but...

Examples of some more detailed logs on test_graphmask_explainer errors (there are too many)

_ test_graph_mask_explainer_binary_classification[None-probs-node-model-MaskType.object-MaskType.object] _

edge_mask_type = <MaskType.object: 'object'>
node_mask_type = <MaskType.object: 'object'>, explanation_type = 'model'
task_level = 'node', return_type = 'probs', index = None

    @pytest.mark.parametrize('edge_mask_type', edge_mask_types)
    @pytest.mark.parametrize('node_mask_type', node_mask_types)
    @pytest.mark.parametrize('explanation_type', ['model', 'phenomenon'])
    @pytest.mark.parametrize('task_level', ['node', 'edge', 'graph'])
    @pytest.mark.parametrize('return_type', ['probs', 'raw'])
    @pytest.mark.parametrize('index', [None, 2, torch.arange(3)])
    def test_graph_mask_explainer_binary_classification(
        edge_mask_type,
        node_mask_type,
        explanation_type,
        task_level,
        return_type,
        index,
    ):
        model_config = ModelConfig(
            mode='binary_classification',
            task_level=task_level,
            return_type=return_type,
        )

        model = GCN(model_config)

        target = None
        if explanation_type == 'phenomenon':
            with torch.no_grad():
                out = model(x, edge_index, batch, edge_label_index)
                if model_config.return_type == ModelReturnType.raw:
                    target = (out > 0).long().view(-1)
                if model_config.return_type == ModelReturnType.probs:
                    target = (out > 0.5).long().view(-1)

        explainer = Explainer(
            model=model,
            algorithm=GraphMaskExplainer(2, epochs=5, log=False),
            explanation_type=explanation_type,
            node_mask_type=node_mask_type,
            edge_mask_type=edge_mask_type,
            model_config=model_config,
        )

>       explanation = explainer(
            x,
            edge_index,
            target=target,
            index=index,
            batch=batch,
            edge_label_index=edge_label_index,
        )

test/explain/algorithm/test_graphmask_explainer.py:133: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../lib/python3.10/site-packages/torch_geometric/explain/explainer.py:204: in __call__
    explanation = self.algorithm(
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:133: in forward
    edge_mask = self._explain(model, index=index)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:515: in _explain
    result = self.gates[(i * 4) + 1][j](partial)
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch/nn/modules/normalization.py:190: in forward
    return F.layer_norm(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = tensor([[-0.1499],
        [-0.2280],
        [-0.2280],
        [-0.1674],
        [-0.1674],
        [-0.0529],
    ...80],
        [-0.1674],
        [-0.0529],
        [ 0.0813],
        [-0.0922],
        [-0.0853],
        [-0.1870]])
normalized_shape = (1,), weight = Parameter containing:
tensor([1.])
bias = Parameter containing:
tensor([0.]), eps = 1e-05

    def layer_norm(
        input: Tensor,
        normalized_shape: List[int],
        weight: Optional[Tensor] = None,
        bias: Optional[Tensor] = None,
        eps: float = 1e-5,
    ) -> Tensor:
        r"""Applies Layer Normalization for last certain number of dimensions.

        See :class:`~torch.nn.LayerNorm` for details.
        """
        if has_torch_function_variadic(input, weight, bias):
            return handle_torch_function(
                layer_norm, (input, weight, bias), input, normalized_shape, weight=weight, bias=bias, eps=eps
            )
>       return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)
E       IndexError: Dimension out of range (expected to be in range of [-2, 1], but got 2)

../../lib/python3.10/site-packages/torch/nn/functional.py:2515: IndexError
_ test_graph_mask_explainer_binary_classification[None-probs-node-model-MaskType.object-None] _

edge_mask_type = None, node_mask_type = <MaskType.object: 'object'>
explanation_type = 'model', task_level = 'node', return_type = 'probs'
index = None

    @pytest.mark.parametrize('edge_mask_type', edge_mask_types)
    @pytest.mark.parametrize('node_mask_type', node_mask_types)
    @pytest.mark.parametrize('explanation_type', ['model', 'phenomenon'])
    @pytest.mark.parametrize('task_level', ['node', 'edge', 'graph'])
    @pytest.mark.parametrize('return_type', ['probs', 'raw'])
    @pytest.mark.parametrize('index', [None, 2, torch.arange(3)])
    def test_graph_mask_explainer_binary_classification(
        edge_mask_type,
        node_mask_type,
        explanation_type,
        task_level,
        return_type,
        index,
    ):
        model_config = ModelConfig(
            mode='binary_classification',
            task_level=task_level,
            return_type=return_type,
        )

        model = GCN(model_config)

        target = None
        if explanation_type == 'phenomenon':
            with torch.no_grad():
                out = model(x, edge_index, batch, edge_label_index)
                if model_config.return_type == ModelReturnType.raw:
                    target = (out > 0).long().view(-1)
                if model_config.return_type == ModelReturnType.probs:
                    target = (out > 0.5).long().view(-1)

        explainer = Explainer(
            model=model,
            algorithm=GraphMaskExplainer(2, epochs=5, log=False),
            explanation_type=explanation_type,
            node_mask_type=node_mask_type,
            edge_mask_type=edge_mask_type,
            model_config=model_config,
        )

>       explanation = explainer(
            x,
            edge_index,
            target=target,
            index=index,
            batch=batch,
            edge_label_index=edge_label_index,
        )

test/explain/algorithm/test_graphmask_explainer.py:133: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../lib/python3.10/site-packages/torch_geometric/explain/explainer.py:204: in __call__
    explanation = self.algorithm(
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:133: in forward
    edge_mask = self._explain(model, index=index)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:515: in _explain
    result = self.gates[(i * 4) + 1][j](partial)
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch/nn/modules/normalization.py:190: in forward
    return F.layer_norm(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = tensor([[ 0.0005],
        [ 0.0181],
        [ 0.0181],
        [ 0.0122],
        [ 0.0122],
        [ 0.0016],
    ...81],
        [ 0.0122],
        [ 0.0016],
        [-0.0261],
        [-0.0473],
        [-0.0218],
        [-0.0230]])
normalized_shape = (1,), weight = Parameter containing:
tensor([1.])
bias = Parameter containing:
tensor([0.]), eps = 1e-05

    def layer_norm(
        input: Tensor,
        normalized_shape: List[int],
        weight: Optional[Tensor] = None,
        bias: Optional[Tensor] = None,
        eps: float = 1e-5,
    ) -> Tensor:
        r"""Applies Layer Normalization for last certain number of dimensions.

        See :class:`~torch.nn.LayerNorm` for details.
        """
        if has_torch_function_variadic(input, weight, bias):
            return handle_torch_function(
                layer_norm, (input, weight, bias), input, normalized_shape, weight=weight, bias=bias, eps=eps
            )
>       return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)
E       IndexError: Dimension out of range (expected to be in range of [-2, 1], but got 2)

../../lib/python3.10/site-packages/torch/nn/functional.py:2515: IndexError
_ test_graph_mask_explainer_binary_classification[None-probs-node-model-MaskType.common_attributes-MaskType.object] _

edge_mask_type = <MaskType.object: 'object'>
node_mask_type = <MaskType.common_attributes: 'common_attributes'>
explanation_type = 'model', task_level = 'node', return_type = 'probs'
index = None

    @pytest.mark.parametrize('edge_mask_type', edge_mask_types)
    @pytest.mark.parametrize('node_mask_type', node_mask_types)
    @pytest.mark.parametrize('explanation_type', ['model', 'phenomenon'])
    @pytest.mark.parametrize('task_level', ['node', 'edge', 'graph'])
    @pytest.mark.parametrize('return_type', ['probs', 'raw'])
    @pytest.mark.parametrize('index', [None, 2, torch.arange(3)])
    def test_graph_mask_explainer_binary_classification(
        edge_mask_type,
        node_mask_type,
        explanation_type,
        task_level,
        return_type,
        index,
    ):
        model_config = ModelConfig(
            mode='binary_classification',
            task_level=task_level,
            return_type=return_type,
        )

        model = GCN(model_config)

        target = None
        if explanation_type == 'phenomenon':
            with torch.no_grad():
                out = model(x, edge_index, batch, edge_label_index)
                if model_config.return_type == ModelReturnType.raw:
                    target = (out > 0).long().view(-1)
                if model_config.return_type == ModelReturnType.probs:
                    target = (out > 0.5).long().view(-1)

        explainer = Explainer(
            model=model,
            algorithm=GraphMaskExplainer(2, epochs=5, log=False),
            explanation_type=explanation_type,
            node_mask_type=node_mask_type,
            edge_mask_type=edge_mask_type,
            model_config=model_config,
        )

>       explanation = explainer(
            x,
            edge_index,
            target=target,
            index=index,
            batch=batch,
            edge_label_index=edge_label_index,
        )

test/explain/algorithm/test_graphmask_explainer.py:133: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../lib/python3.10/site-packages/torch_geometric/explain/explainer.py:204: in __call__
    explanation = self.algorithm(
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:133: in forward
    edge_mask = self._explain(model, index=index)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:515: in _explain
    result = self.gates[(i * 4) + 1][j](partial)
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch/nn/modules/normalization.py:190: in forward
    return F.layer_norm(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = tensor([[ 0.2942],
        [ 0.3121],
        [ 0.3121],
        [ 0.6925],
        [ 0.6925],
        [-1.1122],
    ...21],
        [ 0.6925],
        [-1.1122],
        [-0.4176],
        [-0.3225],
        [ 0.4694],
        [ 0.0182]])
normalized_shape = (1,), weight = Parameter containing:
tensor([1.])
bias = Parameter containing:
tensor([0.]), eps = 1e-05

    def layer_norm(
        input: Tensor,
        normalized_shape: List[int],
        weight: Optional[Tensor] = None,
        bias: Optional[Tensor] = None,
        eps: float = 1e-5,
    ) -> Tensor:
        r"""Applies Layer Normalization for last certain number of dimensions.

        See :class:`~torch.nn.LayerNorm` for details.
        """
        if has_torch_function_variadic(input, weight, bias):
            return handle_torch_function(
                layer_norm, (input, weight, bias), input, normalized_shape, weight=weight, bias=bias, eps=eps
            )
>       return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)
E       IndexError: Dimension out of range (expected to be in range of [-2, 1], but got 2)

../../lib/python3.10/site-packages/torch/nn/functional.py:2515: IndexError
_ test_graph_mask_explainer_binary_classification[None-probs-node-model-MaskType.common_attributes-None] _

edge_mask_type = None
node_mask_type = <MaskType.common_attributes: 'common_attributes'>
explanation_type = 'model', task_level = 'node', return_type = 'probs'
index = None

    @pytest.mark.parametrize('edge_mask_type', edge_mask_types)
    @pytest.mark.parametrize('node_mask_type', node_mask_types)
    @pytest.mark.parametrize('explanation_type', ['model', 'phenomenon'])
    @pytest.mark.parametrize('task_level', ['node', 'edge', 'graph'])
    @pytest.mark.parametrize('return_type', ['probs', 'raw'])
    @pytest.mark.parametrize('index', [None, 2, torch.arange(3)])
    def test_graph_mask_explainer_binary_classification(
        edge_mask_type,
        node_mask_type,
        explanation_type,
        task_level,
        return_type,
        index,
    ):
        model_config = ModelConfig(
            mode='binary_classification',
            task_level=task_level,
            return_type=return_type,
        )

        model = GCN(model_config)

        target = None
        if explanation_type == 'phenomenon':
            with torch.no_grad():
                out = model(x, edge_index, batch, edge_label_index)
                if model_config.return_type == ModelReturnType.raw:
                    target = (out > 0).long().view(-1)
                if model_config.return_type == ModelReturnType.probs:
                    target = (out > 0.5).long().view(-1)

        explainer = Explainer(
            model=model,
            algorithm=GraphMaskExplainer(2, epochs=5, log=False),
            explanation_type=explanation_type,
            node_mask_type=node_mask_type,
            edge_mask_type=edge_mask_type,
            model_config=model_config,
        )

>       explanation = explainer(
            x,
            edge_index,
            target=target,
            index=index,
            batch=batch,
            edge_label_index=edge_label_index,
        )

test/explain/algorithm/test_graphmask_explainer.py:133: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../lib/python3.10/site-packages/torch_geometric/explain/explainer.py:204: in __call__
    explanation = self.algorithm(
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:133: in forward
    edge_mask = self._explain(model, index=index)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:515: in _explain
    result = self.gates[(i * 4) + 1][j](partial)
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch/nn/modules/normalization.py:190: in forward
    return F.layer_norm(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = tensor([[-0.7821],
        [ 0.3164],
        [ 0.3164],
        [-0.6021],
        [-0.6021],
        [ 0.3111],
    ...64],
        [-0.6021],
        [ 0.3111],
        [-0.2455],
        [-0.5185],
        [-0.6260],
        [-0.8519]])
normalized_shape = (1,), weight = Parameter containing:
tensor([1.])
bias = Parameter containing:
tensor([0.]), eps = 1e-05

    def layer_norm(
        input: Tensor,
        normalized_shape: List[int],
        weight: Optional[Tensor] = None,
        bias: Optional[Tensor] = None,
        eps: float = 1e-5,
    ) -> Tensor:
        r"""Applies Layer Normalization for last certain number of dimensions.

        See :class:`~torch.nn.LayerNorm` for details.
        """
        if has_torch_function_variadic(input, weight, bias):
            return handle_torch_function(
                layer_norm, (input, weight, bias), input, normalized_shape, weight=weight, bias=bias, eps=eps
            )
>       return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)
E       IndexError: Dimension out of range (expected to be in range of [-2, 1], but got 2)

../../lib/python3.10/site-packages/torch/nn/functional.py:2515: IndexError
_ test_graph_mask_explainer_binary_classification[None-probs-node-model-MaskType.attributes-MaskType.object] _

edge_mask_type = <MaskType.object: 'object'>
node_mask_type = <MaskType.attributes: 'attributes'>, explanation_type = 'model'
task_level = 'node', return_type = 'probs', index = None

    @pytest.mark.parametrize('edge_mask_type', edge_mask_types)
    @pytest.mark.parametrize('node_mask_type', node_mask_types)
    @pytest.mark.parametrize('explanation_type', ['model', 'phenomenon'])
    @pytest.mark.parametrize('task_level', ['node', 'edge', 'graph'])
    @pytest.mark.parametrize('return_type', ['probs', 'raw'])
    @pytest.mark.parametrize('index', [None, 2, torch.arange(3)])
    def test_graph_mask_explainer_binary_classification(
        edge_mask_type,
        node_mask_type,
        explanation_type,
        task_level,
        return_type,
        index,
    ):
        model_config = ModelConfig(
            mode='binary_classification',
            task_level=task_level,
            return_type=return_type,
        )

        model = GCN(model_config)

        target = None
        if explanation_type == 'phenomenon':
            with torch.no_grad():
                out = model(x, edge_index, batch, edge_label_index)
                if model_config.return_type == ModelReturnType.raw:
                    target = (out > 0).long().view(-1)
                if model_config.return_type == ModelReturnType.probs:
                    target = (out > 0.5).long().view(-1)

        explainer = Explainer(
            model=model,
            algorithm=GraphMaskExplainer(2, epochs=5, log=False),
            explanation_type=explanation_type,
            node_mask_type=node_mask_type,
            edge_mask_type=edge_mask_type,
            model_config=model_config,
        )

>       explanation = explainer(
            x,
            edge_index,
            target=target,
            index=index,
            batch=batch,
            edge_label_index=edge_label_index,
        )

test/explain/algorithm/test_graphmask_explainer.py:133: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../lib/python3.10/site-packages/torch_geometric/explain/explainer.py:204: in __call__
    explanation = self.algorithm(
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:133: in forward
    edge_mask = self._explain(model, index=index)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:515: in _explain
    result = self.gates[(i * 4) + 1][j](partial)
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch/nn/modules/normalization.py:190: in forward
    return F.layer_norm(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = tensor([[-0.0378],
        [-0.0682],
        [-0.0682],
        [-0.0394],
        [-0.0394],
        [-0.0939],
    ...82],
        [-0.0394],
        [-0.0939],
        [-0.0893],
        [-0.0754],
        [-0.0550],
        [-0.0433]])
normalized_shape = (1,), weight = Parameter containing:
tensor([1.])
bias = Parameter containing:
tensor([0.]), eps = 1e-05

    def layer_norm(
        input: Tensor,
        normalized_shape: List[int],
        weight: Optional[Tensor] = None,
        bias: Optional[Tensor] = None,
        eps: float = 1e-5,
    ) -> Tensor:
        r"""Applies Layer Normalization for last certain number of dimensions.

        See :class:`~torch.nn.LayerNorm` for details.
        """
        if has_torch_function_variadic(input, weight, bias):
            return handle_torch_function(
                layer_norm, (input, weight, bias), input, normalized_shape, weight=weight, bias=bias, eps=eps
            )
>       return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)
E       IndexError: Dimension out of range (expected to be in range of [-2, 1], but got 2)

../../lib/python3.10/site-packages/torch/nn/functional.py:2515: IndexError
_ test_graph_mask_explainer_binary_classification[None-probs-node-model-MaskType.attributes-None] _

edge_mask_type = None, node_mask_type = <MaskType.attributes: 'attributes'>
explanation_type = 'model', task_level = 'node', return_type = 'probs'
index = None

    @pytest.mark.parametrize('edge_mask_type', edge_mask_types)
    @pytest.mark.parametrize('node_mask_type', node_mask_types)
    @pytest.mark.parametrize('explanation_type', ['model', 'phenomenon'])
    @pytest.mark.parametrize('task_level', ['node', 'edge', 'graph'])
    @pytest.mark.parametrize('return_type', ['probs', 'raw'])
    @pytest.mark.parametrize('index', [None, 2, torch.arange(3)])
    def test_graph_mask_explainer_binary_classification(
        edge_mask_type,
        node_mask_type,
        explanation_type,
        task_level,
        return_type,
        index,
    ):
        model_config = ModelConfig(
            mode='binary_classification',
            task_level=task_level,
            return_type=return_type,
        )

        model = GCN(model_config)

        target = None
        if explanation_type == 'phenomenon':
            with torch.no_grad():
                out = model(x, edge_index, batch, edge_label_index)
                if model_config.return_type == ModelReturnType.raw:
                    target = (out > 0).long().view(-1)
                if model_config.return_type == ModelReturnType.probs:
                    target = (out > 0.5).long().view(-1)

        explainer = Explainer(
            model=model,
            algorithm=GraphMaskExplainer(2, epochs=5, log=False),
            explanation_type=explanation_type,
            node_mask_type=node_mask_type,
            edge_mask_type=edge_mask_type,
            model_config=model_config,
        )

>       explanation = explainer(
            x,
            edge_index,
            target=target,
            index=index,
            batch=batch,
            edge_label_index=edge_label_index,
        )

test/explain/algorithm/test_graphmask_explainer.py:133: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../lib/python3.10/site-packages/torch_geometric/explain/explainer.py:204: in __call__
    explanation = self.algorithm(
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:133: in forward
    edge_mask = self._explain(model, index=index)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:515: in _explain
    result = self.gates[(i * 4) + 1][j](partial)
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch/nn/modules/normalization.py:190: in forward
    return F.layer_norm(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = tensor([[ 0.0244],
        [ 0.0261],
        [ 0.0261],
        [-0.0057],
        [-0.0057],
        [-0.0456],
    ...61],
        [-0.0057],
        [-0.0456],
        [-0.0711],
        [-0.0126],
        [ 0.0970],
        [ 0.0654]])
normalized_shape = (1,), weight = Parameter containing:
tensor([1.])
bias = Parameter containing:
tensor([0.]), eps = 1e-05

    def layer_norm(
        input: Tensor,
        normalized_shape: List[int],
        weight: Optional[Tensor] = None,
        bias: Optional[Tensor] = None,
        eps: float = 1e-5,
    ) -> Tensor:
        r"""Applies Layer Normalization for last certain number of dimensions.

        See :class:`~torch.nn.LayerNorm` for details.
        """
        if has_torch_function_variadic(input, weight, bias):
            return handle_torch_function(
                layer_norm, (input, weight, bias), input, normalized_shape, weight=weight, bias=bias, eps=eps
            )
>       return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)
E       IndexError: Dimension out of range (expected to be in range of [-2, 1], but got 2)

../../lib/python3.10/site-packages/torch/nn/functional.py:2515: IndexError
_ test_graph_mask_explainer_binary_classification[None-probs-node-phenomenon-MaskType.object-MaskType.object] _

edge_mask_type = <MaskType.object: 'object'>
node_mask_type = <MaskType.object: 'object'>, explanation_type = 'phenomenon'
task_level = 'node', return_type = 'probs', index = None

    @pytest.mark.parametrize('edge_mask_type', edge_mask_types)
    @pytest.mark.parametrize('node_mask_type', node_mask_types)
    @pytest.mark.parametrize('explanation_type', ['model', 'phenomenon'])
    @pytest.mark.parametrize('task_level', ['node', 'edge', 'graph'])
    @pytest.mark.parametrize('return_type', ['probs', 'raw'])
    @pytest.mark.parametrize('index', [None, 2, torch.arange(3)])
    def test_graph_mask_explainer_binary_classification(
        edge_mask_type,
        node_mask_type,
        explanation_type,
        task_level,
        return_type,
        index,
    ):
        model_config = ModelConfig(
            mode='binary_classification',
            task_level=task_level,
            return_type=return_type,
        )

        model = GCN(model_config)

        target = None
        if explanation_type == 'phenomenon':
            with torch.no_grad():
                out = model(x, edge_index, batch, edge_label_index)
                if model_config.return_type == ModelReturnType.raw:
                    target = (out > 0).long().view(-1)
                if model_config.return_type == ModelReturnType.probs:
                    target = (out > 0.5).long().view(-1)

        explainer = Explainer(
            model=model,
            algorithm=GraphMaskExplainer(2, epochs=5, log=False),
            explanation_type=explanation_type,
            node_mask_type=node_mask_type,
            edge_mask_type=edge_mask_type,
            model_config=model_config,
        )

>       explanation = explainer(
            x,
            edge_index,
            target=target,
            index=index,
            batch=batch,
            edge_label_index=edge_label_index,
        )

test/explain/algorithm/test_graphmask_explainer.py:133: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../lib/python3.10/site-packages/torch_geometric/explain/explainer.py:204: in __call__
    explanation = self.algorithm(
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:133: in forward
    edge_mask = self._explain(model, index=index)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:515: in _explain
    result = self.gates[(i * 4) + 1][j](partial)
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch/nn/modules/normalization.py:190: in forward
    return F.layer_norm(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = tensor([[ 0.0056],
        [ 0.0085],
        [ 0.0085],
        [ 0.0075],
        [ 0.0075],
        [ 0.0276],
    ...85],
        [ 0.0075],
        [ 0.0276],
        [ 0.0174],
        [ 0.0257],
        [-0.0016],
        [-0.0115]])
normalized_shape = (1,), weight = Parameter containing:
tensor([1.])
bias = Parameter containing:
tensor([0.]), eps = 1e-05

    def layer_norm(
        input: Tensor,
        normalized_shape: List[int],
        weight: Optional[Tensor] = None,
        bias: Optional[Tensor] = None,
        eps: float = 1e-5,
    ) -> Tensor:
        r"""Applies Layer Normalization for last certain number of dimensions.

        See :class:`~torch.nn.LayerNorm` for details.
        """
        if has_torch_function_variadic(input, weight, bias):
            return handle_torch_function(
                layer_norm, (input, weight, bias), input, normalized_shape, weight=weight, bias=bias, eps=eps
            )
>       return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)
E       IndexError: Dimension out of range (expected to be in range of [-2, 1], but got 2)

../../lib/python3.10/site-packages/torch/nn/functional.py:2515: IndexError
_ test_graph_mask_explainer_binary_classification[None-probs-node-phenomenon-MaskType.object-None] _

edge_mask_type = None, node_mask_type = <MaskType.object: 'object'>
explanation_type = 'phenomenon', task_level = 'node', return_type = 'probs'
index = None

    @pytest.mark.parametrize('edge_mask_type', edge_mask_types)
    @pytest.mark.parametrize('node_mask_type', node_mask_types)
    @pytest.mark.parametrize('explanation_type', ['model', 'phenomenon'])
    @pytest.mark.parametrize('task_level', ['node', 'edge', 'graph'])
    @pytest.mark.parametrize('return_type', ['probs', 'raw'])
    @pytest.mark.parametrize('index', [None, 2, torch.arange(3)])
    def test_graph_mask_explainer_binary_classification(
        edge_mask_type,
        node_mask_type,
        explanation_type,
        task_level,
        return_type,
        index,
    ):
        model_config = ModelConfig(
            mode='binary_classification',
            task_level=task_level,
            return_type=return_type,
        )

        model = GCN(model_config)

        target = None
        if explanation_type == 'phenomenon':
            with torch.no_grad():
                out = model(x, edge_index, batch, edge_label_index)
                if model_config.return_type == ModelReturnType.raw:
                    target = (out > 0).long().view(-1)
                if model_config.return_type == ModelReturnType.probs:
                    target = (out > 0.5).long().view(-1)

        explainer = Explainer(
            model=model,
            algorithm=GraphMaskExplainer(2, epochs=5, log=False),
            explanation_type=explanation_type,
            node_mask_type=node_mask_type,
            edge_mask_type=edge_mask_type,
            model_config=model_config,
        )

>       explanation = explainer(
            x,
            edge_index,
            target=target,
            index=index,
            batch=batch,
            edge_label_index=edge_label_index,
        )

test/explain/algorithm/test_graphmask_explainer.py:133: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../lib/python3.10/site-packages/torch_geometric/explain/explainer.py:204: in __call__
    explanation = self.algorithm(
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:133: in forward
    edge_mask = self._explain(model, index=index)
../../lib/python3.10/site-packages/torch_geometric/explain/algorithm/graphmask_explainer.py:515: in _explain
    result = self.gates[(i * 4) + 1][j](partial)
../../lib/python3.10/site-packages/torch/nn/modules/module.py:1501: in _call_impl
    return forward_call(*args, **kwargs)
../../lib/python3.10/site-packages/torch/nn/modules/normalization.py:190: in forward
    return F.layer_norm(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = tensor([[ 0.0648],
        [ 0.1313],
        [ 0.1313],
        [ 0.1122],
        [ 0.1122],
        [-0.0125],
    ...13],
        [ 0.1122],
        [-0.0125],
        [-0.0559],
        [ 0.0382],
        [ 0.0179],
        [ 0.0616]])
normalized_shape = (1,), weight = Parameter containing:
tensor([1.])
bias = Parameter containing:
tensor([0.]), eps = 1e-05

    def layer_norm(
        input: Tensor,
        normalized_shape: List[int],
        weight: Optional[Tensor] = None,
        bias: Optional[Tensor] = None,
        eps: float = 1e-5,
    ) -> Tensor:
        r"""Applies Layer Normalization for last certain number of dimensions.

        See :class:`~torch.nn.LayerNorm` for details.
        """
        if has_torch_function_variadic(input, weight, bias):
            return handle_torch_function(
                layer_norm, (input, weight, bias), input, normalized_shape, weight=weight, bias=bias, eps=eps
            )
>       return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)
E       IndexError: Dimension out of range (expected to be in range of [-2, 1], but got 2)

../../lib/python3.10/site-packages/torch/nn/functional.py:2515: IndexError

Environment

rusty1s commented 1 year ago

I am not so sure about the GraphMaskExplainer test failures, but the neighbor loader tests should work if you upgrade to pyg-lib nightly.

beew commented 12 months ago

I am not so sure about the GraphMaskExplainer test failures, but the neighbor loader tests should work if you upgrade to pyg-lib nightly.

Upgrade to pyg-lib nightly still a lot of failed tests

============================================================================================= short test summary info =============================================================================================
FAILED test/data/lightning/test_datamodule.py::test_lightning_hetero_link_data_custom_store - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_cache.py::test_cached_loader[device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_cache.py::test_cached_loader_transform[device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_imbalanced_sampler.py::test_neighbor_loader_with_imbalanced_sampler - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_imbalanced_sampler.py::test_hetero_neighbor_loader_with_imbalanced_sampler - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_basic[None-None-directional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_basic[None-None-bidirectional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_basic[None-1.0-directional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_basic[None-1.0-bidirectional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_basic[True-None-directional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_basic[True-None-bidirectional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_basic[True-1.0-directional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_basic[True-1.0-bidirectional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_basic[False-None-directional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_basic[False-None-bidirectional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_basic[False-1.0-directional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_basic[False-1.0-bidirectional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_hetero_link_neighbor_loader_basic[None-directional] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_hetero_link_neighbor_loader_basic[None-bidirectional] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_hetero_link_neighbor_loader_basic[1.0-directional] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_hetero_link_neighbor_loader_basic[1.0-bidirectional] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_hetero_link_neighbor_loader_loop[directional] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_hetero_link_neighbor_loader_loop[bidirectional] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_link_neighbor_loader_edge_label - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_temporal_homo_link_neighbor_loader[1] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_temporal_hetero_link_neighbor_loader - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_custom_hetero_link_neighbor_loader - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_no_edges - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_hetero_link_neighbor_loader_no_edges - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_triplet[1-False-False] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_triplet[1-False-True] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_triplet[1-True-True] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_triplet[2-False-False] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_triplet[2-False-True] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_homo_link_neighbor_loader_triplet[2-True-True] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_hetero_link_neighbor_loader_triplet[1-False-False] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_hetero_link_neighbor_loader_triplet[1-False-True] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_hetero_link_neighbor_loader_triplet[1-True-True] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_hetero_link_neighbor_loader_triplet[2-False-False] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_hetero_link_neighbor_loader_triplet[2-False-True] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_hetero_link_neighbor_loader_triplet[2-True-True] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_link_neighbor_loader.py::test_link_neighbor_loader_mapping - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_basic[None-dtype0-SubgraphType.directional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_basic[None-dtype0-SubgraphType.bidirectional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_basic[None-dtype1-SubgraphType.directional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_basic[None-dtype1-SubgraphType.bidirectional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_basic[True-dtype0-SubgraphType.directional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_basic[True-dtype0-SubgraphType.bidirectional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_basic[True-dtype1-SubgraphType.directional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_basic[True-dtype1-SubgraphType.bidirectional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_basic[False-dtype0-SubgraphType.directional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_basic[False-dtype0-SubgraphType.bidirectional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_basic[False-dtype1-SubgraphType.directional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_basic[False-dtype1-SubgraphType.bidirectional-device0] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_hetero_neighbor_loader_basic[dtype0-SubgraphType.directional] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_hetero_neighbor_loader_basic[dtype0-SubgraphType.bidirectional] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_hetero_neighbor_loader_basic[dtype1-SubgraphType.directional] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_hetero_neighbor_loader_basic[dtype1-SubgraphType.bidirectional] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_on_cora[SubgraphType.directional] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_on_cora[SubgraphType.bidirectional] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_hetero_neighbor_loader_on_cora[SubgraphType.directional] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_hetero_neighbor_loader_on_cora[SubgraphType.bidirectional] - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_temporal_hetero_neighbor_loader_on_cora - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_custom_neighbor_loader - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_temporal_custom_neighbor_loader_on_cora - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_pyg_lib_and_torch_sparse_homo_equality - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_pyg_lib_and_torch_sparse_hetero_equality - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_memmap_neighbor_loader - RuntimeError: Caught RuntimeError in DataLoader worker process 0.
FAILED test/loader/test_neighbor_loader.py::test_homo_neighbor_loader_sampled_info - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_hetero_neighbor_loader_sampled_info - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_neighbor_loader_mapping - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_weighted_homo_neighbor_loader - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_neighbor_loader.py::test_weighted_hetero_neighbor_loader - RuntimeError: pyg::hetero_neighbor_sample() Expected a value of type 'Optional[Dict[str, Tensor]]' for argument 'edge_weight_dict' but instead found type 'bool'.
FAILED test/loader/test_utils.py::test_index_select_out_of_range - RuntimeError: INDICES element is out of DATA bounds, id=3 axis_dim=3
FAILED test/loader/test_zip_loader.py::test_zip_loader[True] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/loader/test_zip_loader.py::test_zip_loader[False] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/nn/conv/test_pna_conv.py::test_pna_conv_get_degree_histogram_neighbor_loader - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/nn/models/test_basic_gnn.py::test_basic_gnn_inference[None] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/nn/models/test_basic_gnn.py::test_basic_gnn_inference[last] - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/nn/models/test_basic_gnn.py::test_trim_to_layer - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/nn/models/test_basic_gnn.py::test_basic_gnn_cache - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.
FAILED test/utils/test_trim_to_layer.py::test_trim_to_layer_with_neighbor_loader - RuntimeError: pyg::neighbor_sample() Expected a value of type 'Optional[Tensor]' for argument 'edge_weight' but instead found type 'bool'.

All tests passed for 2.3.1 so I am downgrading.

rusty1s commented 11 months ago

Are you sure you are testing on latest PyG? It looks like you use an earlier version of PyG to test against.

beew commented 11 months ago

Are you sure you are testing on latest PyG? It looks like you use an earlier version of PyG to test against.

I am pretty sure. The GraphMaskExplainer test is not in pyg < 2.4.0

rusty1s commented 11 months ago

Sorry, maybe this was confusing. Are you running the latest tests against PyG == 2.4.0 or against the latest version of PyG from master?

beew commented 11 months ago

Sorry, maybe this was confusing. Are you running the latest tests against PyG == 2.4.0 or against the latest version of PyG from master?

2.4.0. I grabbed the tests from the latest release tarball (instead of cloning from git)

rusty1s commented 11 months ago

Got it, if you are running on fixed 2.4.0, then you will need pyg-lib==0.3.*.

sandeepmukh commented 9 months ago

I'm seeing this Neighborloader issue even with pyg-lib==0.3.1. Is there another potential fix?

rusty1s commented 9 months ago

Are you sure you are not on pyg-lib==0.4.0 (just released yesterday)? Support for it will be added in the next PyG version which we will release ASAP.

sandeepmukh commented 9 months ago

Yes—I was originally, but I downgraded after seeing your message above.