Comments (1)
把前面生成模型的features和labels+= 转换成float32格式完美解决
######float64和32报错
num_inputs = 2
num_examples = 1000
true_w = [2, -3.4]
true_b = 4.2
features = torch.from_numpy(np.random.normal(0, 1, (num_examples, num_inputs)))
features = features.to(torch.float32)
labels = true_w[0] * features[:, 0] + true_w[1] * features[:, 1] + true_b
dd = torch.from_numpy(np.random.normal(0, 0.01, size=labels.size()))
dd = dd.to(torch.float32)
labels += dd
features[0],labels[0]
#####或者是
num_inputs = 2
num_examples = 1000
true_w = [2, -3.4]
true_b = 4.2
features = torch.randn(num_examples, num_inputs)
labels = true_w[0] * features[:, 0] + true_w[1] * features[:, 1] + true_b
labels += torch.tensor(np.random.normal(0, 0.01, size=labels.size()), dtype=torch.float)
from dive-into-dl-pytorch.
Related Issues (20)
- test
- 4.5.2.1节的书写错误
- 9.4 锚框一节里的画出bbox 的注释书写错误
- 章节 5.6.2 AlexNet 第一个卷积层的comment描述有出入
- 2.2.2节符号错误:应该是+=1而非-=1
- 2.3.3梯度结果问题请教 HOT 1
- 5.6节的描述错误
- 10.4 子词嵌入(fastText)有书写错误
- 10.7.2 torchtext 好像版本更新了,没有stoi属性,且换成新版本get_stoi依旧由于
- 4.4.2 函数报错问题
- 5.6.2 AlexNet最后卷积层的输出大小应该为256*6*6
- 5.2节步幅内容错误
- 3.9节的net中是否要加入softmax HOT 1
- 请问咱们这个pytorch版本有纸质版吗?
- Deprecated use of IPython.display.set_matplotlib_formats
- 现在pytorch的版本已经修改了很多东西希望能对内容进行更新
- 3.5节fashion-mnist.ipynb下载FashionMNIST数据集太慢,有其他载入数据集的办法吗(jupyternotrbook) HOT 1
- 3.16 实战Kaggle比赛:房价预测 np转成tensor会报错问题 HOT 4
- test
- Kaggle房价预测调用dl2中的semilogy函数会报错 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dive-into-dl-pytorch.