Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

torch库在前面没有 导入(3.11.4.1) #33

Closed
vuexiaob opened this issue Feb 3, 2020 · 1 comment
Closed

torch库在前面没有 导入(3.11.4.1) #33

vuexiaob opened this issue Feb 3, 2020 · 1 comment

Comments

@vuexiaob
Copy link

vuexiaob commented Feb 3, 2020

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]
+ true_w[2] * poly_features[:, 2] + true_b)
labels += torch.tensor(np.random.normal(0, 0.01, size=labels.size()), dtype=torch.float)

@archersama
Copy link
Collaborator

已修复,删去pytorch的api,换成tensorflow2的api

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants