Get up to speed with the deep learning concepts of Pytorch using a problem-solution approach. Starting with an introduction to PyTorch, you'll get familiarized with tensors, a type of data structure used to calculate arithmetic operations and also learn how they operate. You will then take a look at probability distributions using PyTorch and get acquainted with its concepts. Further you will dive into transformations and graph computations with PyTorch. Along the way you will take a look at common issues faced with neural network implementation and tensor differentiation, and get the best solutions for them. Moving on to algorithms; you will learn how PyTorch works with supervised and unsupervised algorithms. You will see how convolutional neural networks, deep neural networks, and recurrent neural networks work using PyTorch. In conclusion you will get acquainted with natural language processing and text processing using PyTorch. What You Will Learn • Master tensor operations for dynamic graph-based calculations using PyTorch • Create PyTorch transformations and graph computations for neural networks • Carry out supervised and unsupervised learning using PyTorch • Work with deep learning algorithms such as CNN and RNN • Build LSTM models in PyTorch • Use PyTorch for text processing Who This Book Is For Readers wanting to dive straight into programming PyTorch. Table of Contents 5 About the Author 13 About the Technical Reviewer 14 Acknowledgments 15 Introduction 16 Chapter 1: Introduction to PyTorch, Tensors, and Tensor Operations 18 What Is PyTorch? 23 PyTorch Installation 24 Recipe 1-1. Using Tensors 26 Problem 26 Solution 27 How It Works 27 Conclusion 44 Chapter 2: Probability Distributions Using PyTorch 45 Recipe 2-1. Sampling Tensors 46 Problem 46 Solution 46 How It Works 46 Recipe 2-2. Variable Tensors 49 Problem 49 Solution 50 How It Works 51 Recipe 2-3. Basic Statistics 52 Problem 52 Solution 52 How It Works 52 Recipe 2-4. Gradient Computation 54 Problem 54 Solution 54 How It Works 55 Recipe 2-5. Tensor Operations 57 Problem 57 Solution 57 How It Works 57 Recipe 2-6. Tensor Operations 58 Problem 58 Solution 58 How It Works 59 Recipe 2-7. Distributions 61 Problem 61 Solution 61 How It Works 61 Conclusion 64 Chapter 3: CNN and RNN Using PyTorch 65 Recipe 3-1. Setting Up a Loss Function 65 Problem 65 Solution 66 How It Works 66 Recipe 3-2. Estimating the Derivative of the Loss Function 69 Problem 69 Solution 69 How It Works 69 Recipe 3-3. Fine-Tuning a Model 75 Problem 75 Solution 75 How It Works 76 Recipe 3-4. Selecting an Optimization Function 78 Problem 78 Solution 78 How It Works 78 Recipe 3-5. Further Optimizing the Function 83 Problem 83 Solution 83 How It Works 83 Recipe 3-6. Implementing a Convolutional Neural Network (CNN) 87 Problem 87 Solution 87 How It Works 87 Recipe 3-7. Reloading a Model 93 Problem 93 Solution 93 How It Works 93 Recipe 3-8. Implementing a Recurrent Neural Network (RNN) 96 Problem 96 Solution 96 How It Works 96 Recipe 3-9. Implementing a RNN for Regression Problems 101 Problem 101 Solution 102 How It Works 102 Recipe 3-10. Using PyTorch Built-in Functions 103 Problem 103 Solution 103 How It Works 104 Recipe 3-11. Working with Autoencoders 107 Problem 107 Solution 107 How It Works 107 Recipe 3-12. Fine-Tuning Results Using Autoencoder 111 Problem 111 Solution 111 How It Works 111 Recipe 3-13. Visualizing the Encoded Data in a 3D Plot 114 Problem 114 Solution 114 How It Works 114 Recipe 3-14. Restricting Model Overfitting 115 Problem 115 Solution 115 How It Works 116 Recipe 3-15. Visualizing the Model Overfit 118 Problem 118 Solution 118 How It Works 118 Recipe 3-16. Initializing Weights in the Dropout Rate 120 Problem 120 Solution 120 How It Works 121 Recipe 3-17. Adding Math Operations 122 Problem 122 Solution 122 How It Works 122 Recipe 3-18. Embedding Layers in RNN 124 Problem 124 Solution 124 How It Works 124 Conclusion 125 Chapter 4: Introduction to Neural Networks Using PyTorch 126 Recipe 4-1. Working with Activation Functions 127 Problem 127 Solution 127 How It Works 127 Linear Function 128 Bilinear Function 128 Sigmoid Function 129 Hyperbolic Tangent Function 130 Log Sigmoid Transfer Function 131 ReLU Function 132 Leaky ReLU 133 Recipe 4-2. Visualizing the Shape of Activation Functions 134 Problem 134 Solution 134 How It Works 134 Recipe 4-3. Basic Neural Network Model 137 Problem 137 Solution 137 How It Works 137 Recipe 4-4. Tensor Differentiation 140 Problem 140 Solution 140 How It Works 140 Conclusion 141 Chapter 5: Supervised Learning Using PyTorch 142 Introduction to Linear Regression 144 Recipe 5-1. Data Preparation for the Supervised Model 148 Problem 148 Solution 148 How It Works 148 Recipe 5-2. Forward and Backward Propagation 150 Problem 150 Solution 150 How It Works 151 Recipe 5-3. Optimization and Gradient Computation 154 Problem 154 Solution 154 How It Works 155 Recipe 5-4. Viewing Predictions 156 Problem 156 Solution 156 How It Works 156 Recipe 5-5. Supervised Model Logistic Regression 160 Problem 160 Solution 160 How It Works 160 Conclusion 164 Chapter 6: Fine-Tuning Deep Learning Models Using PyTorch 165 Recipe 6-1. Building Sequential Neural Networks 167 Problem 167 Solution 167 How It Works 167 Recipe 6-2. Deciding the Batch Size 169 Problem 169 Solution 169 How It Works 169 Recipe 6-3. Deciding the Learning Rate 172 Problem 172 Solution 172 How It Works 172 Recipe 6-4. Performing Parallel Training 176 Problem 176 Solution 177 How It Works 177 Conclusion 178 Chapter 7: Natural Language Processing Using PyTorch 179 Recipe 7-1. Word Embedding 182 Problem 182 Solution 183 How It Works 183 Recipe 7-2. CBOW Model in PyTorch 186 Problem 186 Solution 187 How It Works 187 Recipe 7-3. LSTM Model 189 Problem 189 Solution 189 How It Works 189 Index 193 "Get up to speed with the deep learning concepts of Pytorch using a problem-solution approach. Starting with an introduction to PyTorch, you'll get familiarized with tensors, a type of data structure used to calculate arithmetic operations and also learn how they operate. You will then take a look at probability distributions using PyTorch and get acquainted with its concepts. Further you will dive into transformations and graph computations with PyTorch. Along the way you will take a look at common issues faced with neural network implementation and tensor differentation, and get the best solutions for them. Moving on to algorithms; you will learn how PyTorch works with supervised and unsupervised algorithms. You will see how convolutional neural networks, deep neural networks, and recurrent neural networks work using PyTorch. In conclusion you will get acquainted with natural language processing and text processing using PyTorch."--Provided by publisher Front Matter ....Pages i-xx Introduction to PyTorch, Tensors, and Tensor Operations (Pradeepta Mishra)....Pages 1-27 Probability Distributions Using PyTorch (Pradeepta Mishra)....Pages 29-48 CNN and RNN Using PyTorch (Pradeepta Mishra)....Pages 49-109 Introduction to Neural Networks Using PyTorch (Pradeepta Mishra)....Pages 111-126 Supervised Learning Using PyTorch (Pradeepta Mishra)....Pages 127-149 Fine-Tuning Deep Learning Models Using PyTorch (Pradeepta Mishra)....Pages 151-164 Natural Language Processing Using PyTorch (Pradeepta Mishra)....Pages 165-178 Back Matter ....Pages 179-184 Chapter 1: Introduction PyTorch, Tensors, Tensor Operations and Basics.- Chapter 2: Probability distributions using PyTorch.- Chapter 3: Convolutional Neural Network and RNN using PyTorch.- Chapter 4: Introduction to Neural Networks, Tensor Differentiation .- Chapter 5: Supervised Learning using PyTorch.- Chapter 6: Fine Tuning Deep Learning Algorithms using PyTorch.- Chapter 7: NLP and Text Processing using PyTorch.-