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 solution

Now that we have learned how to specify the problem using an MDP, the agent needs to formulate a strategy to solve it. This strategy can also be called a policy.

Policies and value functions

A policy defines the learning agent's way of behaving at a given time. A policy is denoted by the Greek letter Pi. The policy cannot be defined by a formula; it's more of an intuition-based concept.

Let's take an example. For a robot that needs to find a way out of a room, it may have the following policies:

  • Go randomly
  • Go along the walls
  • Find the shortest path to the door

For us to mathematically predict which action to take in a particular state, we need a function. Let's define a function that takes in the current state and outputs a number that signifies how valuable that state is to be in. For example, if you want to cross the river, a position near the bridge would be more valuable than the state far from it. This function is called the value function...