PyG 自定义数据集报错 IndexError: Dimension out of range (expected to be in range of [-1, 0], but got -2)
使用Pytorch-Geometric框架自定义数据集时,报错IndexError:Dimensionoutofrange(expectedtobeinrangeof[-1,0],butgot-2)原因:我这边的情况是N个节点,每个节点只有一个特征,Data(x,y,edge_index)中的x为一维张量时会报错。解决方法:改为二维张量。x=torch.from_numpy(features[i]