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

The problem

In this chapter, I will first explain a problem to solve and then explain the concepts, while fixing the problem we have. The problem is finding the similarity between two English sentences with three different approaches. To make the comparison fair, we'll use word embeddings in all the implementations. Don't worry, we'll go through word embeddings as well. The problem in hand is commonly called an entailment problem, where we have two sentences at each instance and our job is to predict the similarity between these sentences. We could classify the sentences into three categories:

  • Entailment: both sentences mean the same thing:
    • A soccer game with multiple males playing.
    • Some men are playing a sport.
  • Neutral: both sentences have something in common:
    • An older and younger man smiling.
    • Two men are smiling and laughing at the cats playing on the floor.
  • Contradiction: both sentences convey two different meanings:
    • A black race car starts up in front of a crowd...