Hanjun-Dai / pytorch_structure2vec

pytorch implementation of structure2vec (https://arxiv.org/abs/1603.05629)
MIT License
305 stars 76 forks source link

object 'MySpMM' has no attribute 'apply' #6

Closed muhanzhang closed 6 years ago

muhanzhang commented 6 years ago

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!

Hanjun-Dai commented 6 years ago

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

muhanzhang commented 6 years ago

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