Verifique se dois scipy.sparse.csr_matrix são iguais

Quero verificar se doiscsr_matrix são iguais.

Se eu fizer:

x.__eq__(y)

Eu recebo:

raise ValueError("The truth value of an array with more than one "
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all().

Isso, no entanto, funciona bem:

assert (z in x for z in y)

Há uma melhor forma de fazê-lo? talvez usando algumscipy função otimizada?

Muito obrigado

questionAnswers(1)

yourAnswerToTheQuestion