PyTorch for Deep Learning: Get Started

AC
Data Folks Indonesia
2 min readSep 6, 2021
pytorch.org

PyTorch is a python deep learning library that allows you to create and train a deep learning model easily. You may know deep learning libraries like TensorFlow and Keras, but this is a deep learning library that I like so much!

1. Brief

PyTorch is mainly developed by Facebook engineer. It releases a stable version that allows you to bring deep learning model to production. The current version is 1.9 and has a specific command on how to install the library on different types of machine. As far as I know, PyTorch support CPU and NVIDIA GPU only, It recent development on AMD GPU has experienced a problem. What makes PyTorch is so powerful is that there are a lot of python library that build on top of pytorch such as torchvision, timm for computer vision, torchtext and huggingface for text, and torchaudio for speech. Below is a full list pytorch environment.

2. Installation

To install PyTorch is really easy, you just need select this option in the website pytorch.org. If you are using GPU, make sure CUDA is installed correctly.

pytorch.org

3. Tensor

Creating a tensor in PyTorch is really simple.

4. Activation Functions

These are some of the activation functions that are commonly used.

5. Build Architecture Neural Networks

6. Build Dataset Class

7. Optimizer and Loss Function

8. Training Routine

Closing

That’s it. I have written some code that may help you to start to learn deep learning using PyTorch. To use this tutorial, you need copy and paste the code in to jupyter notebook/lab and try to debug and understand what the function do. There are tons of APIs and hidden functions in PyTorch. But, this basic hands-on will help you to learn and find the path.

--

--