question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

graph_sage example code

See original GitHub issue

❓ Questions & Help

Hello, when I run the graph_sage example code (copy from pytorch_geometric/examples/graph_sage_unsup.py), somthing goes wrong, may I ask if this is caused by a version problem?

Traceback (most recent call last):
  File "/home/yf/code/gnn_explainer/examples/graphsage_Cora.py", line 117, in <module>
    loss = train()
  File "/home/yf/code/gnn_explainer/examples/graphsage_Cora.py", line 83, in train
    for batch_size, n_id, adjs in train_loader:
  File "/home/yf/app/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 345, in __next__
    data = self._next_data()
  File "/home/yf/app/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "/home/yf/app/anaconda3/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch
    return self.collate_fn(data)
  File "/home/yf/code/gnn_explainer/examples/graphsage_Cora.py", line 38, in sample
    return super(NeighborSampler, self).sample(batch)
  File "/home/yf/app/anaconda3/lib/python3.6/site-packages/torch_geometric/data/sampler.py", line 109, in sample
    adj, n_id = self.adj.sample_adj(n_id, size, replace=False)
AttributeError: 'SparseTensor' object has no attribute 'sample_adj'

Versions

python: 3.6.6
pytorch: 1.4.0
cuda: 10.0
torch_sparse: 0.6.1
torch_geometric: 1.6.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rusty1scommented, Nov 2, 2020

I see. What happens if you remove the @torch.jit.script annotations in torch_sparse/storage.py and torch_sparse/tensor.py? Removing this should lead to backward compatibility.

1reaction
moonwalker12138commented, Nov 1, 2020

Thanks again for your help, but unfortunately another problem appeared when I replace row = idx // num_cols with row = idx / num_cols(no other changes) and run import torch_sparse

RuntimeError: 
Unknown type name 'torch.device':
  File "/home/yf/app/anaconda3/envs/pyg/lib/python3.6/site-packages/torch_sparse/tensor.py", line 77
    @classmethod
    def eye(self, M: int, N: Optional[int] = None, has_value: bool = True,
            dtype: Optional[int] = None, device: Optional[torch.device] = None,
                                                          ~~~~~~~~~~~~ <--- HERE
            fill_cache: bool = False):
Read more comments on GitHub >

github_iconTop Results From Across the Web

GraphSAGE for Classification in Python | Well Enough
GraphSAGE is an inductive graph neural network capable of representing and classifying previously unseen nodes with high accuracy.
Read more >
Introduction to GraphSAGE in Python - Towards Data Science
GraphSAGE is a Graph Neural Network designed to manage billions of nodes and edges thanks to neighbor sampling and a fast aggregator.
Read more >
GraphSage: Representation Learning on Large Graphs - GitHub
This directory contains code necessary to run the GraphSage algorithm. GraphSage can be viewed as a stochastic generalization of graph convolutions, ...
Read more >
GraphSAGE on the CORA citation network - StellarGraph
Stellargraph example: GraphSAGE on the CORA citation network¶. Run the master version of this notebook: Import stellargraph: [1]:.
Read more >
GraphSAGE - SNAP: Stanford
Motivation; Code; Datasets; Contributors; References ... To run GraphSAGE, it needs to train on an example graph or set of graphs. After training,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found