- 博客(2)
- 收藏
- 关注
原创 3.12_ValueError: x and y must have same first dimension, but have shapes (100,) and (1,)
在练习3.12-权重衰减时,运行如下代码报错:#定义和训练测试batch_size,num_epochs,lr = 1,100,0.003net,loss = d2l.linreg,d2l.squared_lossdataset = torch.utils.data.TensorDataset(train_features,train_labels)train_iter = torch.utils.data.DataLoader(dataset,batch_size,shuffle=True
2021-09-21 15:55:03
15803
原创 3.9-unsupported operand type(s) for *: ‘float‘ and ‘NoneType‘
实操的时候,前面六个代码块都正常运行,但是最后一步训练模型时报错,如图:#训练模型num_epochs, lr = 5, 100.0d2l.train_ch3(net, train_iter, test_iter, loss, num_epochs, batch_size, params, lr)提示是*这个字符连接的“float”和“NoneType”的操作数类型不受支持,但是这一行代码并没有错误,GitHub下载了教学的代码,也可以顺利运行。经过从后往前的一步步排查,发现是定义模型参.
2021-09-18 15:56:47
4406
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人