PyTorch: Difference between revisions

 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:


==Installation==
==Installation==
See [https://pytorch.org/get-started/locally/ PyTorch Getting Started]
See [https://pytorch.org/get-started/locally/ PyTorch Getting Started] and [https://pytorch.org/get-started/previous-versions/ PyTorch Previous Versions]
<syntaxhighlight lang="bash">


# If using conda, python 3.5+, and CUDA 10.0 (+ compatible cudnn)
I recommend using the conda installation method since it is paired with the correct version of cuda.
conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
</syntaxhighlight>


==Getting Started==
==Getting Started==
Line 45: Line 42:


==Usage==
==Usage==
Note that there are some useful functions under <code>torch.nn.functional</code> which is typically imported as <code>F</code>.
Note that there are several useful functions under <code>torch.nn.functional</code> which is typically imported as <code>F</code>.
Most neural network layers are actually implemented in functional.


===torch.meshgrid===
===torch.meshgrid===
Line 79: Line 77:
See [https://pytorch.org/tutorials/beginner/former_torchies/parallelism_tutorial.html Multi-GPU Examples].
See [https://pytorch.org/tutorials/beginner/former_torchies/parallelism_tutorial.html Multi-GPU Examples].


==nn.DataParallel==
===nn.DataParallel===


The basic idea is to wrap blocks in [https://pytorch.org/docs/stable/generated/torch.nn.DataParallel.html#torch.nn.DataParallel <code>nn.DataParallel</code>].   
The basic idea is to wrap blocks in [https://pytorch.org/docs/stable/generated/torch.nn.DataParallel.html#torch.nn.DataParallel <code>nn.DataParallel</code>].   
Line 176: Line 174:
</syntaxhighlight>
</syntaxhighlight>


==PyTorch3D==
==Libraries==
A list of useful libraries
 
===torchvision===
https://pytorch.org/vision/stable/index.html
 
Official tools for image manipulation such as blur, bounding boxes.
 
===torchmetrics===
https://torchmetrics.readthedocs.io/en/stable/
 
Various metrics such as PSNR, SSIM, LPIPS
 
===PyTorch3D===
{{main | PyTorch3D}}
{{main | PyTorch3D}}
[https://github.com/facebookresearch/pytorch3d PyTorch3D] is a library by Facebook AI Research which contains differentiable renderers for meshes and point clouds. 
[https://github.com/facebookresearch/pytorch3d PyTorch3D]
It is built using custom CUDA kernels and only runs on Linux.
 
Facebook library with differentiable renderers for meshes and point clouds.