Learn practical skills, build real-world projects, and advance your career
# Jovian Commit Essentials
# Please retain and execute this cell without modifying the contents for `jovian.commit` to work
!pip install jovian --upgrade -q
import jovian
jovian.utils.colab.set_colab_file_id('18HadGB4VzhPeVuZ7IR2snrdWl7bQ46lG')
# Uncomment and run the appropriate command for your operating system, if required

# Linux / Binder
# !pip install numpy torch==1.7.0+cpu torchvision==0.8.1+cpu torchaudio==0.7.0 -f https://download.pytorch.org/whl/torch_stable.html

# Windows
# !pip install numpy torch==1.7.0+cpu torchvision==0.8.1+cpu torchaudio==0.7.0 -f https://download.pytorch.org/whl/torch_stable.html

# MacOS
# !pip install numpy torch torchvision torchaudio

Playing with Torch Fundamentals

An short introduction about PyTorch and about the chosen functions.

  • torch.sparse_coo_tensor
  • torch.zeros_like
  • torch.arange
  • torch.as_strided
  • torch.linspace
# Import torch and other required modules
import torch

Function 1 - torch.sparse_coo_tensor

torch.sparse_coo_tensor(indices, values, size=None, *, dtype=None, device=None, requires_grad=False) → Tensor

Constructs a sparse tensors in coordinate format with non-zero elements at the given indices with the given values