def tran_predy(y_pred):
a = y_pred.detach().numpy()#先将tensor转换成numpy数组
c = []#一维数组变二维
for i in a:
tmp = [float(i)]
c.append(tmp)
d = torch.tensor(c)#变成tensor类型
return d
Using a target size (torch.Size([10, 1])) that is different to the input size (torch.Size([10])) is
最新推荐文章于 2023-06-15 14:37:51 发布