[Python] Converting a scipy coo_matrix to pytorch sparse tensor

Discussão em 'Python' iniciado por Stack, Fevereiro 26, 2025.

  1. Stack

    Stack Membro Participativo

    I have a coo_matrix:

    from scipy.sparse import coo_matrix
    coo = coo_matrix((3, 4), dtype = "int8")


    That I want converted to a pytorch sparse tensor. According to the documentation https://pytorch.org/docs/master/sparse.html it should follow the coo format, but I cannot find a simple way to do the conversion. Any help would be greatly appreciated!

    Continue reading...

Compartilhe esta Página