Shen-Lab / GraphCL

[NeurIPS 2020] "Graph Contrastive Learning with Augmentations" by Yuning You, Tianlong Chen, Yongduo Sui, Ting Chen, Zhangyang Wang, Yang Shen
MIT License
541 stars 103 forks source link

RuntimeError: Expected object of scalar type Long but got scalar type Float for argument #3 'index' in call to _th_scatter_add_ #44

Open 5672004gmpc3 opened 2 years ago

5672004gmpc3 commented 2 years ago

================ lr: 0.01 num_features: 89 hidden_dim: 32 num_gc_layers: 3

Traceback (most recent call last): File "gsimclr.py", line 188, in emb, y = model.encoder.get_embeddings(dataloader_eval) File "/home/m10915046/GraphCL/unsupervised_TU/gin.py", line 76, in getembeddings x, = self.forward(x, edge_index, batch) File "/home/m10915046/GraphCL/unsupervised_TU/gin.py", line 58, in forward xpool = [global_add_pool(x, batch) for x in xs] File "/home/m10915046/GraphCL/unsupervised_TU/gin.py", line 58, in xpool = [global_add_pool(x, batch) for x in xs] File "/home/m10915046/anaconda3/envs/graphcl2/lib/python3.6/site-packages/torch_geometric/nn/glob/glob.py", line 26, in global_add_pool return scatter(x, batch, dim=0, dim_size=size, reduce='add') File "/home/m10915046/anaconda3/envs/graphcl2/lib/python3.6/site-packages/torch_scatter/scatter.py", line 154, in scatter return scatter_sum(src, index, dim, out, dim_size) RuntimeError: Expected object of scalar type Long but got scalar type Float for argument #3 'index' in call to _th_scatteradd The above operation failed in interpreter. Traceback (most recent call last): File "/home/m10915046/anaconda3/envs/graphcl2/lib/python3.6/site-packages/torch_scatter/scatter.py", line 27 size[dim] = int(index.max()) + 1 out = torch.zeros(size, dtype=src.dtype, device=src.device) return out.scatteradd(dim, index, src)


    else:
        return out.scatter_add_(dim, index, src)
yyou1996 commented 2 years ago

Hi @5672004gmpc3,

Please double-check for the dependencies (https://github.com/Shen-Lab/GraphCL/tree/master/unsupervised_TU#dependencies), make sure the versions are corrected as recommended.