cyclops-community / ctf

Cyclops Tensor Framework: parallel arithmetic on multidimensional arrays
Other
199 stars 53 forks source link

sparse tensor in ctf.einsum #47

Closed sunqm closed 6 years ago

sunqm commented 6 years ago

For some contraction patterns, ctf.einsum crashes when operands are sparse tensors

n = 40
a1 = ctf.tensor((n,n,n), sp=1)
b1 = ctf.tensor((n,n,n), sp=1)
c1 = ctf.tensor((n,n,n))
a1.fill_sp_random(0., 1., 0.001)
b1.fill_sp_random(0., 1., 0.001)
c1.fill_sp_random(0., 1., 0.001)

ctf.einsum('ijk,jkl->ijkl', a1, b1)
ctf.einsum('ijk,jkl->ijkl', a1, c1)
kostrzewa commented 6 years ago

I've also noticed that sparse * dense contractions result in zeroes in the result where there shouldn't be any. These issues could be related.

solomonik commented 6 years ago

This test should now work, previously the limitation was the presence of Hadamard indices as part of the contraction. However, the current method for handling sparsity for Hadamard indices can perform badly (see commit description for 44c09cb and new issue #53).