资讯详情

PyG 自定义数据集报错 IndexError: Dimension out of range (expected to be in range of [-1, 0], but got...

使用Pytorch-Geometric当框架自定义数据集时,报错 IndexError: Dimension out of range (expected to be in range of [-1, 0], but got -2)

我这边的情况是N个节点,每个节点只有,Data(x, y, edge_index)中的 x 为 时会报错。

改为

x = torch.from_numpy(features[i]) # x: tensor([ 0.7407, -0.1673, 0.1678, 0.1453, -0.2432, -0.7662, 0.1561]) # x.size(): torch.Size([7]) # 训练会报错 IndexError: 阿巴阿巴 but got -2  x = torch.from_numpy(features[i].reshape(-1, 1)) # x: tensor([[ 0.7407], # [-0.1673], # [ 0.1678], # [ 0.1453], # [-0.2432], # [-0.7662], # [ 0.1561]]) # x.size(): torch.Size([7,1]) # 正常训练   

标签: hps拉绳位稳传感器

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台