Commonly Used 'torch' Funcitons

This section describes some commonly used PyTorch functions, including add(), multiply(), matmul(), tf.reduce_sum(), tf.nn.softmax(), etc.

As a quick reference, here is a list of commonly used PyTorch, "torch" library, functions:

1. Functions provided by the "torch" module itself:

import torch

torch.empty(m, n, ...) - Creates an empty tensor with the given shape.

torch.rand(m, n, ...) - Creates a tensor of random values with the given shape.

torch.torch.zeros(m, n, ...) - Creates a tensor of zeros with the given shape.

torch.tensor([[...],[...],...]) - Creates an tensor with the given date.

torch.rand_like(a) - Creates an empty tensor with the given shape.

a.size() - Returns the size (shape) of this tensor.

torch.add(a,b) - Creates a tensor by taking the sum of two given tensors. Same as (a+b).

a.add_(b) - Updates this tensor by adding values from the given tensor.

x.view(n, m, ...) - Creates a tensor by reshaping this tensor with the given shape.

Table of Contents

 About This Book

 Deep Playground for Classical Neural Networks

 Building Neural Networks with Python

 Simple Example of Neural Networks

 TensorFlow - Machine Learning Platform

PyTorch - Machine Learning Platform

 What Is PyTorch

 Install PyTorch Library

Commonly Used 'torch' Funcitons

 CNN (Convolutional Neural Network)

 RNN (Recurrent Neural Network)

 GNN (Graph Neural Network)


 Full Version in PDF/EPUB