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.

Lacking backend for data loaded by PyG

See original GitHub issue

❓ Questions & Help

I have installed PyG on MacOS as follows

pip install torch-scatter==latest+cpu torch-sparse==latest+cpu -f https://s3.eu-central-1.amazonaws.com/pytorch-geometric.com/whl/torch-1.4.0.html
pip install torch-geometric

on top of an Anaconda environment and pytorch 1.4

When I tried to load ModelNet with the following test code

import torch
import torch_sparse
import torch_scatter
a = torch.Tensor([1, 2, 3])
print(len(a))

from torch_geometric.datasets import ModelNet
mn10 = ModelNet("~/data/")
print(len(mn10))

After the dataset has been successfully downloaded and processed, I encountered the following errors:

3
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-11-1f88dfc65aaa> in <module>
      7 from torch_geometric.datasets import ModelNet
      8 mn10 = ModelNet("~/data/")
----> 9 print(len(mn10))

~/toolbox/anaconda3/envs/ml/lib/python3.7/site-packages/torch_geometric/data/dataset.py in __len__(self)
    177         if self.__indices__ is not None:
    178             return len(self.__indices__)
--> 179         return self.len()
    180 
    181     def __getitem__(self, idx):

~/toolbox/anaconda3/envs/ml/lib/python3.7/site-packages/torch_geometric/data/in_memory_dataset.py in len(self)
     61 
     62     def len(self):
---> 63         for item in self.slices.values():
     64             return len(item) - 1
     65         return 0

RuntimeError: Could not run 'aten::values' with arguments from the 'CPUTensorId' backend. 'aten::values' is only available for these backends: [SparseCPUTensorId, VariableTensorId].

As seen above, the prerequisites seem to be working. As I am not familiar with custom Op’s in PyTorch and new to PyG, I cannot say this is a bug or I haven’t put the appropriate libraries together properly.

Plz advice.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
WhatAShotcommented, May 31, 2020

Hi, I get a similar error. I install pytorch1.5 with cuda 101. When I get MNISTSuperpixel, an error:

RuntimeError: Could not run 'aten::values' with arguments from the 'CPUTensorId' backend. 'aten::values' is only available for these backends: [SparseCPUTensorId, SparseCUDATensorId, VariableTensorId].

Plz advice.


I fix this issue. I perfer to share the reason/solution here…

The default folder name of MNISTSuperpixels in the official examples is “MNIST”. If you do not change the folder name manually, the dataset will be downloaded and stored in the same folder with the original MNIST dataset (if already downloaded) and the subfolder ‘processed’ will NOT BE re-write! Thus, when you manage to load MNISTSuperpixels, you actually load the original MNIST and an error will raise, ‘RuntimeError: Could not run ‘aten::values’ with arguments from the ‘CPUTensorId’ backend.’ (as the default of the GNN input is sparse but the MNIST images are plain 2D images).

0reactions
rusty1scommented, May 31, 2020

Do you know where the error occurs?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Loading the fixed data split from the original PyTorch ... - GitHub
When loading PyG datasets using DeepSNAP backend, the fixed splits will be discarded. That was the default behavior of DeepSNAP.
Read more >
Managing Experiments with GraphGym - PyTorch Geometric
Scenario 1: You are a beginner to graph representation learning and want to understand how GNNs work: You probably have read many exciting...
Read more >
PyTorch Geometric vs Deep Graph Library - Exxact Corporation
Deep Graph Library is a flexible library that can utilize PyTorch or TensorFlow as a backend. We'll use PyTorch for this demonstration, but...
Read more >
Build Recommendation Systems with PyTorch Geometric and ...
In this blog post, we will build a complete movie recommendation application using ArangoDB and PyTorch Geometric. We will tackle the challenge of...
Read more >
graphgym - Python Package Health Analysis - Snyk
Data : Data loading, data splitting; Model: Modularized GNN implementation ... Run GraphGym with Pytorch Geometric (PyG) backend ...
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