Learn practical skills, build real-world projects, and advance your career

Pytorch

  • PyTorch is an open source machine learning library based on the Torch library, used for applications such as computer vision and natural language processing, primarily developed by Facebook's AI Research lab (FAIR). It is free and open-source software released under the Modified BSD license. Although the Python interface is more polished and the primary focus of development, PyTorch also has a C++ interface.
  • A number of pieces of Deep Learning software are built on top of PyTorch, including Uber's Pyro, HuggingFace's Transformers, and Catalyst.
  • It is also one of the preferred deep learning research platforms built to provide maximum flexibility and speed. It is known for providing two of the most high-level features; namely, tensor computations with strong GPU acceleration support and building deep neural networks on a tape-based autograd systems.

Pytorch : Tensors

  • A PyTorch Tensor is basically the same as a numpy array: it does not know anything about deep learning or computational graphs or gradients, and is just a generic n-dimensional array to be used for arbitrary numeric computation.
  • The biggest difference between a numpy array and a PyTorch Tensor is that a PyTorch Tensor can run on either CPU or GPU.

Math operations

Most common opeartions

Here are some functions

  • torch.abs()
  • torch.add()
  • torch.sub()
  • torch.div()
  • torch.mul()
  • torch.neg()
  • torch.pow()
  • torch.reciprocal()
  • torch.remainder()
  • torch.square()
# First install torch library by following commands if not installed in your system
# !conda install pytorch cpuonly -c pytorch -y
# Importing pytorch library
import torch