Question 1: Single choice
hardAI-checkedTraining Deep NetworksA hand-written layer normalization puts its smoothing term outside the square root. What does the last line print?
import torch
x = torch.tensor([2.0, 2.0, 2.0], requires_grad=True) # all features equal
mean = x.mean()
var = x.var(correction=0)
z = (x - mean) / (torch.sqrt(var) + 1e-3)
z.sum().backward()
print(x.grad)