Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

processing with karate datasets #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

processing with karate datasets #13

wants to merge 3 commits into from

Conversation

ycq091044
Copy link

No description provided.

@ycq091044
Copy link
Author

I have trained a GCN to get the node embedings for karate dataset.
The codes, revised model files and the result pic are listed.

@tkipf
Copy link
Owner

tkipf commented Jul 17, 2018 via email

@tiredDi
Copy link

tiredDi commented Jun 2, 2019

I have trained a GCN to get the node embedings for karate dataset.
The codes, revised model files and the result pic are listed.

Hi,thanks for your sharing.
I run your code to create two file: karate.cites and karate.content, it success. However when I runed train_karate.py, it made this mistake:
RuntimeError: Expected object of type torch.cuda.LongTensor but found type torch.LongTensor for argument #3 'index'

This question point to this sentence:
loss = criterion(torch.index_select(output, 0, indices),torch.LongTensor([0,1,2,3]))
(I try to change it to: loss = criterion(torch.index_select(output, 0, indices),torch.cuda.LongTensor([0,1,2,3])) , but it doesn't work)

The complete error is as follow:
/home/wtu/anaconda3/envs/py/lib/python3.5/site-packages/torch/nn/functional.py:995: UserWarning: nn.functional.tanh is deprecated. Use torch.tanh instead.
warnings.warn("nn.functional.tanh is deprecated. Use torch.tanh instead.")
/home/wtu/project/pygcn_data/models2.py:22: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
return F.softmax(x)
Traceback (most recent call last):
File "/home/wtu/project/pygcn_data/train_karate.py", line 92, in
train(epoch)
File "/home/wtu/project/pygcn_data/train_karate.py", line 80, in train
loss = criterion(torch.index_select(output, 0, indices),torch.LongTensor([0,1,2,3]))
RuntimeError: Expected object of type torch.cuda.LongTensor but found type torch.LongTensor for argument #3 'index'

looking forward to your reply

@tkipf
Copy link
Owner

tkipf commented Jun 3, 2019 via email

@tiredDi
Copy link

tiredDi commented Jun 4, 2019

Try running it on CPU only or out that tensor explicitly on GPU.

Thanks for your reply, I work it out.
I change "loss = criterion(torch.index_select(output, 0, indices),torch.LongTensor([0,1,2,3]))" to
"loss = criterion(torch.index_select(output, 0, indices),torch.cuda.LongTensor([0,1,2,3]))"
and change "indices = torch.LongTensor([0, 16,18,24])" to
"indices = torch.cuda.LongTensor([0, 16,18,24])"
Then success~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants