EDIT: Sorry about the last question, PyTorch supports broadcasting 76 like NumPy, you just have to keep the dimension:
means = train_data.mean(dim=1, keepdim=True)
stds = train_data.std(dim=1, keepdim=True)
normalized_data = (train_data - means) / stds