PyTorch get started:修订间差异
无编辑摘要 |
无编辑摘要 |
||
第1行: | 第1行: | ||
= Installation = | |||
== Conda Installation== | == Conda Installation== | ||
第30行: | 第31行: | ||
[0.1182, 0.3233, 0.9071]]) | [0.1182, 0.3233, 0.9071]]) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
= Concepts = | |||
== Tensor == | |||
Tensors are a specialized data structure that are very similar to arrays and matrices. In PyTorch, we use tensors to encode the inputs and outputs of a model, as well as the model’s parameters. | |||
Tensors are similar to NumPy’s ndarrays, except that tensors can run on GPUs or other hardware accelerators. | |||
[[Category:Deep Learning]] | [[Category:Deep Learning]] | ||
[[Category:PyTorch]] | [[Category:PyTorch]] |
2023年12月11日 (一) 04:36的版本
Installation
Conda Installation
conda create --name deeplearning python=3.11
conda activate deeplearning
python --version
// 3.11.5
Install pytorch
conda install pytorch::pytorch torchvision torchaudio -c pytorch
To verify:
import torch
x = torch.rand(5, 3)
print(x)
Output:
tensor([[0.2162, 0.2653, 0.6725],
[0.5371, 0.4180, 0.1353],
[0.3697, 0.5238, 0.0332],
[0.6179, 0.5008, 0.9435],
[0.1182, 0.3233, 0.9071]])
Concepts
Tensor
Tensors are a specialized data structure that are very similar to arrays and matrices. In PyTorch, we use tensors to encode the inputs and outputs of a model, as well as the model’s parameters.
Tensors are similar to NumPy’s ndarrays, except that tensors can run on GPUs or other hardware accelerators.