Hanjun-Dai/pytorch_structure2vec

object 'MySpMM' has no attribute 'apply'

muhanzhang opened this issue · 2 comments

Hi, I am doing graph classification experiments. In the folder "graph_classification", I type "./run.sh", and get the following errors. Do you have any idea?

pytorch_structure2vec/graph_classification/../s2v_lib/pytorch_util.py", line 70, in gnn_spmm
return MySpMM.apply(sp_mat, dense_mat)
AttributeError: type object 'MySpMM' has no attribute 'apply'

It seems the torch.autograd.Function class does not have a method "apply".
I am using python2.7 and cuda 8.0. I have tried different versions of PyTorch (0.3.1, 0.3.0, 0.2.0), and no one works.

I am new to PyTorch. Thanks for help!

I've tested under 0.3.1 and it works fine.

Actually this part of code was modified from here:
https://gist.github.com/anonymous/49c10bc17ac4a97307d52c07d01a2870

as suggested in this discussion:
https://discuss.pytorch.org/t/does-pytorch-support-autograd-on-sparse-matrix/6156/6

Thanks. After removing my legacy version of pytorch, it works now under 0.3.1.