Book Image

PyTorch Deep Learning Hands-On

By : Sherin Thomas, Sudhanshu Passi
Book Image

PyTorch Deep Learning Hands-On

By: Sherin Thomas, Sudhanshu Passi

Overview of this book

PyTorch Deep Learning Hands-On is a book for engineers who want a fast-paced guide to doing deep learning work with PyTorch. It is not an academic textbook and does not try to teach deep learning principles. The book will help you most if you want to get your hands dirty and put PyTorch to work quickly. PyTorch Deep Learning Hands-On shows how to implement the major deep learning architectures in PyTorch. It covers neural networks, computer vision, CNNs, natural language processing (RNN), GANs, and reinforcement learning. You will also build deep learning workflows with the PyTorch framework, migrate models built in Python to highly efficient TorchScript, and deploy to production using the most sophisticated available tools. Each chapter focuses on a different area of deep learning. Chapters start with a refresher on how the model works, before sharing the code you need to implement it in PyTorch. This book is ideal if you want to rapidly add PyTorch to your deep learning toolset.
Table of Contents (11 chapters)
10
Index

Approaches

We'll implement all the three methods: a basic RNN, an advanced RNN like LSTM or GRU, and a recursive network like SPINN, before looping through the SNLI dataset. Each data instance gives us a pair of sentences, a premise, and a hypothesis sentence. The sentences are converted to embeddings first and then passed into each implementation. While the process is the same for simple RNNs and advanced RNNs, SPINNs introduce a completely different flow for training and inference. Let's start with a simple RNN.

Simple RNN

RNNs have been used as the go-to NLP technique for understanding the meaning of data, and we can complete a numerous variety of tasks based on the sequential relations found from it. We will use this simple RNN to show how recurrence works effectively to accumulate the meaning and understand the meaning of words based on the context the words are in.

Before we start building any core modules of our network, we'll have to process the dataset and...