Learn practical skills, build real-world projects, and advance your career
!conda install pytorch cpuonly -c pytorch -y
Collecting package metadata (current_repodata.json): done Solving environment: done ## Package Plan ## environment location: /home/arjita/anaconda3 added / updated specs: - cpuonly - pytorch The following packages will be downloaded: package | build ---------------------------|----------------- cpuonly-1.0 | 0 2 KB pytorch ninja-1.9.0 | py37hfd86e86_0 1.2 MB pytorch-1.5.1 | py3.7_cpu_0 37.9 MB pytorch ------------------------------------------------------------ Total: 39.1 MB The following NEW packages will be INSTALLED: cpuonly pytorch/noarch::cpuonly-1.0-0 ninja pkgs/main/linux-64::ninja-1.9.0-py37hfd86e86_0 pytorch pytorch/linux-64::pytorch-1.5.1-py3.7_cpu_0 Downloading and Extracting Packages pytorch-1.5.1 | 37.9 MB | ##################################### | 100% ninja-1.9.0 | 1.2 MB | ##################################### | 100% cpuonly-1.0 | 2 KB | ##################################### | 100% Preparing transaction: done Verifying transaction: done Executing transaction: done
import torch
# Number
t1 = torch.tensor(4.)
t1
tensor(4.)
t1.dtype
torch.float32
# Vector
t2 = torch.tensor([1., 2, 3, 4])
t2
tensor([1., 2., 3., 4.])