3.1 What is PyTorch?

3.1.1 Tensors

Assignment

Make use of the pytorch docs http://pytorch.org/docs/torch

  1. Make a tensor of size (2, 17)
  2. Make a torch.FloatTensor of size (3, 1)
  3. Make a torch.LongTensor of size (5, 2, 1)
  4. Make a torch.ByteTensor of size (5,)

3.1.2 Operations

Assignment

  1. multiplication of two tensors (see torch.Tensor.mul)
  2. do the same, but inplace
  3. division of two tensors (see torch.Tensor.div)
  4. perform a matrix multiplication of two tensors of size (2, 4) and (4, 2)

3.1.3 Numpy Bridge

Assignment

  1. create a tensor of size (5, 2) containing ones