AD Teaching Wiki
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

FrontPage

Revision 3 as of 2024-01-30 10:52:39
AD Teaching Wiki:
  • PyTorchCheatSheet

A short overview over the PyTorch operations most relevant for this course. The full documentation can be accessed here.

Operation

Description

torch.empty

Create a tensor of a specific shape with uninitialized data

torch.zeros

Create a tensor of a specific shape and fill it with zeros

torch.ones

Create a tensor of a specific shape and fill it with ones

torch.tensor

Create a tensor with the given data

torch.sparse_coo_tensor

Create a sparse tensor with the given indices and values

torch.matmul

Perform matrix multiplication

torch.nonzero

Find the indices where a tensor contains non-zero values

torch.sort

Return the sorted values and sorting permutation of a tensor

torch.stack

Concatenate a list of tensors along a new dimension

torch.cat

Concatenate a list of tensors along an existing dimension

torch.sum

Sum a tensor along one or more dimensions

torch.mean

Average a tensor along one or more dimensions

torch.norm

Calculate the norm of tensor along the given dimensions

torch.where

Return a new tensor containing values from one of two sources depending on a condition

torch.topk

Get top k largest or smallest values and their indices from a tensor

torch.sigmoid

Apply the sigmoid function to all values of a tensor

torch.index_select

Select indices from a tensor along a specific dimension

torch.arange

Create a tensor from a range

torch.multinomial

Sample from a multinomial distribution

  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01