3.1 What is PyTorch?
3.1.1 Tensors
Assignment
Make use of the pytorch docs http://pytorch.org/docs/torch
- Make a tensor of size (2, 17)
- Make a torch.FloatTensor of size (3, 1)
- Make a torch.LongTensor of size (5, 2, 1)
- fill the entire tensor with 7s
- Make a torch.ByteTensor of size (5,)
- fill the middle 3 indices with ones such that it records [0, 1, 1, 1, 0]
3.1.2 Operations
Assignment
- multiplication of two tensors (see torch.Tensor.mul)
- do the same, but inplace
- division of two tensors (see torch.Tensor.div)
- perform a matrix multiplication of two tensors of size (2, 4) and (4, 2)
3.1.3 Numpy Bridge
Assignment
- create a tensor of size (5, 2) containing ones