Pytorch基本使用
文章目录
60分钟入门pytorch
|
|
|
|
1 2 3 4 5 6 |
tensor(1.00000e-13 * [[ 0.0000, 0.0000, 0.0000], [ 0.0000, 0.0015, 0.0000], [ 0.0000, 0.0000, 0.0000], [ 0.0000, 0.0000, 0.0000], [ 3.2014, 0.0000, 0.0000]]) |
|
|
1 2 3 4 5 |
tensor([[ 0.8019, 0.8890, 0.8821], [ 0.2941, 0.4110, 0.9602], [ 0.9998, 0.7436, 0.7854], [ 0.6871, 0.3687, 0.3176], [ 0.0838, 0.4599, 0.9497]]) |
|
|
|
|
1 2 3 4 5 6 |
tensor([[ 1., 1., 1.], [ 1., 1., 1.], [ 1., 1., 1.], [ 1., 1., 1.], [ 1., 1., 1.]], dtype=torch.float64) torch.Size([5, 3]) |
operator
|
|
|
|
1 2 3 4 5 6 7 8 9 10 11 |
tensor([[ 0.4151, 1.7114, 0.6965], [ 1.1274, 0.6298, 1.3228], [ 1.0572, 1.5267, 1.6896], [ 0.7696, 0.6144, 0.9410], [ 1.2071, 1.1116, 0.9585]]) tensor([[ 0.4151, 1.1274, 1.0572, 0.7696, 1.2071], [ 1.7114, 0.6298, 1.5267, 0.6144, 1.1116], [ 0.6965, 1.3228, 1.6896, 0.9410, 0.9585]]) tensor([ 0.4151, 1.7114, 0.6965, 1.1274, 0.6298, 1.3228, 1.0572, 1.5267, 1.6896, 0.7696, 0.6144, 0.9410, 1.2071, 1.1116, 0.9585]) |
trans to numpy
|
|
1 2 |
[2. 2. 2. 2. 2.] tensor([ 2., 2., 2., 2., 2.], dtype=torch.float64) |
autograd
|
|
1 2 3 |
<AddBackward0 object at 0x000002862DC79518> tensor([[ 4.5000, 4.5000], [ 4.5000, 4.5000]]) |
|
|
1
|
False |
文章作者 Sun.StriKE
上次更新 2019-03-27 (417d97f)