Skip to main content

Command Palette

Search for a command to run...

Cheat Sheet Deep learning_PyTorch

Published
1 min readView as Markdown

torch.matmul(a, b) # multiples torch tensors a and b

* # element-wise multiplication between two torch tensorstorch.eye(n) # creates an identity torch tensor with shape (n, n)

torch.zeros(n, m) # creates a torch tensor of zeros with shape (n, m)

torch.ones(n, m) # creates a torch tensor of ones with shape (n, m)

torch.rand(n, m) # creates a random torch tensor with shape (n, m)

torch.tensor(l) # creates a torch tensor based on list l