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.

Bug in dgl.data.utils.generate_mask_tensor

See original GitHub issue

🐛 Bug

I am trying to generate a mask tensor for nodes and it shows the error as below. It seems bool type masks cannot be saved because the dlpack does not support bool type. I tried to change the source code to generate a float type tensor as a mask and it worked.

Environment

  • DGL Version 0.6.1:
  • PyTorch 1.10.0
  • OS windos:
  • How you installed DGL (pip):
  • Build command you used (if compiling from source):
  • Python version 3.7:

Error

`Using backend: pytorch Successfully added node data Traceback (most recent call last): File “C:/Users/Ray Tan/Documents/hetero_t2i/codes/magnn/hetro_graph_data_loader.py”, line 124, in <module> a = SGLoader() File “C:/Users/Ray Tan/Documents/hetero_t2i/codes/magnn/hetro_graph_data_loader.py”, line 42, in init super().init(‘SG’) File “C:\Users\Ray Tan.conda\envs\torch_1_2\lib\site-packages\dgl\data\dgl_dataset.py”, line 93, in init self._load() File “C:\Users\Ray Tan.conda\envs\torch_1_2\lib\site-packages\dgl\data\dgl_dataset.py”, line 179, in _load self.save() File “C:/Users/Ray Tan/Documents/hetero_t2i/codes/magnn/hetro_graph_data_loader.py”, line 45, in save save_graphs(os.path.join(self.save_path, self.name + ‘_dgl_graph.bin’), [self.g]) File “C:\Users\Ray Tan.conda\envs\torch_1_2\lib\site-packages\dgl\data\graph_serialize.py”, line 130, in save_graphs save_heterographs(filename, g_list, labels) File “C:\Users\Ray Tan.conda\envs\torch_1_2\lib\site-packages\dgl\data\heterograph_serialize.py”, line 28, in save_heterographs gdata_list = [HeteroGraphData.create(g) for g in g_list] File “C:\Users\Ray Tan.conda\envs\torch_1_2\lib\site-packages\dgl\data\heterograph_serialize.py”, line 28, in <listcomp> gdata_list = [HeteroGraphData.create(g) for g in g_list] File “C:\Users\Ray Tan.conda\envs\torch_1_2\lib\site-packages\dgl\data\heterograph_serialize.py”, line 42, in create ndata_list.append(tensor_dict_to_ndarray_dict(g.nodes[ntype].data)) File “C:\Users\Ray Tan.conda\envs\torch_1_2\lib\site-packages\dgl\data\heterograph_serialize.py”, line 17, in tensor_dict_to_ndarray_dict ndarray_dict[key] = F.zerocopy_to_dgl_ndarray(value) File “C:\Users\Ray Tan.conda\envs\torch_1_2\lib\site-packages\dgl\backend\pytorch\tensor.py”, line 324, in zerocopy_to_dgl_ndarray return nd.from_dlpack(dlpack.to_dlpack(data.contiguous())) RuntimeError: Bool type is not supported by dlpack

Process finished with exit code 1 `

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
VoVAllencommented, Nov 5, 2021

@PolarisRisingWar We’re going to release 0.7.2 to patch this problem and we’re in the final pre-release stage. For now, you can use our nightly version by pip install --pre dgl-cu102 -f https://data.dgl.ai/wheels-test/repo.html

0reactions
VoVAllencommented, Nov 5, 2021

We expect to release 0.7.2 early next week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dgl.data.utils — DGL 0.2 documentation - DGL Docs
Source code for dgl.data.utils. """Dataset utilities.""" from __future__ import absolute_import import os, sys import hashlib import warnings import zipfile ...
Read more >
from dgl.data.chem import mol_to_bigraph, smiles_to_bigraph ...
My data is SMILES, and I want to convert it into graph and build model using DGL package. I have installed the dgl...
Read more >
A Graph Convolution Network in SageMaker - DataChef
Every dataset in the DGL package inherits from dgl.data.DGLDataset . This base class formulates utilities for downloading, processing, saving, ...
Read more >
How to use the dgl.data.load_data function in dgl - Snyk
To help you get started, we've selected a few dgl.data.load_data examples, ... the potential bugs of to_networkx for (n1, n2, d) in G.edges(data=True): ......
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