Warm Up Exercise¶
To get you back into the PyTorch groove, let’s do some easy exercises. You will have 10 minutes. See how far you can get.
torch.randnto create two tensors of size (29, 30, 32) and and (32, 100).
torch.matmulto matrix multiply the two tensors.
torch.sumon the resulting tensor, passing the optional argument of
dim=1to sum across the 1st dimension. Before you run this, can you predict the size?
- Create a new long tensor of size (3, 10) from the
- Use this new long tensor to index into the tensor from step 3.
torch.meanto average across the last dimension in the tensor from step 5.