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:
- Created 2 years ago
- Comments:6
@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
We expect to release 0.7.2 early next week.