Closed vuexiaob closed 4 years ago
3.11.4.1 生成数据集 该小节,torch库在前面没有 导入,我是在本地安装了Pytorch,然后import torch,就可以成功了。
n_train, n_test, true_w, true_b = 100, 100, [1.2, -3.4, 5.6], 5 features = torch.randn((n_train + n_test, 1)) poly_features = torch.cat((features, torch.pow(features, 2), torch.pow(features, 3)), 1) labels = (true_w[0] poly_features[:, 0] + true_w[1] poly_features[:, 1]
已修复,删去pytorch的api,换成tensorflow2的api
3.11.4.1 生成数据集 该小节,torch库在前面没有 导入,我是在本地安装了Pytorch,然后import torch,就可以成功了。
n_train, n_test, true_w, true_b = 100, 100, [1.2, -3.4, 5.6], 5 features = torch.randn((n_train + n_test, 1)) poly_features = torch.cat((features, torch.pow(features, 2), torch.pow(features, 3)), 1) labels = (true_w[0] poly_features[:, 0] + true_w[1] poly_features[:, 1]