Torch-geometric

When I set batch size to 512, an error is reported:
RuntimeError: nonzero is not supported for tensors with more than INT_MAX elements, file a support request

But when I set batch size to 256, it will run, why?

Report error code at :

def dense_to_sparse(tensor):
    r"""Converts a dense adjacency matrix to a sparse adjacency matrix defined
    by edge indices and edge attributes.

    Args:
        tensor (Tensor): The dense adjacency matrix.
     :rtype: (:class:`LongTensor`, :class:`Tensor`)
    """
    assert tensor.dim() == 2
    index = tensor.nonzero(as_tuple=False).t().contiguous()
    value = tensor[index[0], index[1]]
    return index, value

Thank you very much for your reply

Could you create an issue on GitHub and explain your use case there?
Based on the error message it seems there is an internal limitation for nonzero using INT_MAX elements.

I have met the same error:
File “/home/lib/python3.6/site-packages/torch_geometric/utils/sparse.py”, line 18, in dense_to_sparse
index = tensor.nonzero().t().contiguous()
RuntimeError: nonzero is not supported for tensors with more than INT_MAX elements, file a support request

When I set batch size to 20, it will run, but when I set batch size to 40 or 30, the error will be reported.

So I wonder if you have solved this problem?