pytorch_sparse
pytorch_sparse copied to clipboard
shape matching issue in set_diag
It seems like pytorch_sparse issue: Traceback (most recent call last): File "preprocessing.py", line 142, in main() File "preprocessing.py", line 100, in main adj = get_adj(row, col, N, asymm_norm=args.undirected_asymm_norm, set_diag=args.undirected_set_diag, remove_diag=args.undirected_remove_diag) File "preprocessing.py", line 19, in get_adj adj = adj.set_diag() File "/home/zhu044/.local/lib/python3.6/site-packages/torch_sparse/diag.py", line 96, in self, values, k) File "/home/zhu044/.local/lib/python3.6/site-packages/torch_sparse/diag.py", line 47, in set_diag new_row[mask] = row RuntimeError: shape mismatch: value tensor of shape [50238473] cannot be broadcast to indexing result of shape [50056641]
Can you give a little more information of the adj that produces this error? Do you have a simple example to reproduce?
Can you give a little more information of the adj that produces this error? Do you have a simple example to reproduce?
parser = argparse.ArgumentParser(description='OGBN-papers100M (MLP)')
parser.add_argument('--num_propagations', type=int, default=3)
parser.add_argument('--dropedge_rate', type=float, default=0.3)
args = parser.parse_args()
# SGC pre-processing ######################################################
dataset = PygNodePropPredDataset('ogbn-papers100M')
split_idx = dataset.get_idx_split()
data = dataset[0]
x = data.x.numpy()
N = data.num_nodes
print('Making the graph undirected.')
### Randomly drop some edges to save computation
data.edge_index, _ = dropout_adj(data.edge_index, p = args.dropedge_rate, num_nodes= data.num_nodes)
data.edge_index = to_undirected(data.edge_index, data.num_nodes)
print(data)
row, col = data.edge_index
print('Computing adj...')
adj = SparseTensor(row=row, col=col, sparse_sizes=(N, N))
adj = adj.set_diag()
I also tried SIGN code on papers100, the same problem happend
Has this bug been fixed? I also encountered a similar problem
It works fine for me on my end. What's the problem you encounter?