Tensors
A tensor is PyTorch's array: numbers of one type, in a shape. It works like a NumPy array, and it can also remember how it was computed, which is what lets a network learn.
import torch
x = torch.tensor([[1.0, 2.0], [3.0, 4.0]])
print(x.shape) # torch.Size([2, 2])
print(x.dtype) # torch.float32
print(x.mean(dim=0)) # tensor([2., 3.])
print(x[:, 1]) # second columndim=0 runs down the rows, so the result has one value per column. Operations between a (rows, cols) tensor and a (cols,) tensor apply the second to every row: this is broadcasting.
Models expect inputs on similar scales. Standardising each column, so it has mean 0 and standard deviation 1, is the usual first step.
Your task
Write standardize(x) returning x with every column shifted to mean 0 and scaled to standard deviation 1 (use unbiased=False). Write first_rows(x, n) returning the first n rows.
The explanation opens here once every check passes.