提交 d3d7a3fe 编写于 作者: W wizardforcel

2021-01-15 23:40:54

上级 2713acfd
......@@ -181,7 +181,7 @@ example_2 = torch.randint(low=0, high=2, \
tensor_1 = torch.tensor([0.1,1,0.9,0.7,0.3])
tensor_2 = torch.tensor([[0,0.2,0.4,0.6],[1,0.8,0.6,0.4]])
tensor_3 = torch.tensor([[[0.3,0.6],[1,0]], \
                          [[0.3,0.6],[0,1]]])
[[0.3,0.6],[0,1]]])
```
如果您的计算机具有可用的 GPU,则可以使用 GPU 语法创建等效张量:
......@@ -189,9 +189,9 @@ example_2 = torch.randint(low=0, high=2, \
```py
tensor_1 = torch.tensor([0.1,1,0.9,0.7,0.3]).cuda()
tensor_2 = torch.tensor([[0,0.2,0.4,0.6], \
                        [1,0.8,0.6,0.4]]).cuda()
[1,0.8,0.6,0.4]]).cuda()
tensor_3 = torch.tensor([[[0.3,0.6],[1,0]], \
                         [[0.3,0.6],[0,1]]]).cuda()
[[0.3,0.6],[0,1]]]).cuda()
```
3. Print the shape of each of the tensors using the **shape** property, just as you would do with NumPy arrays:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册