From what I understand, I think torch.autograd.backward([y], [grad]) is that we apply function grad to y. I do not know if it is right?

No. This will compute the gradient of all leaf nodes in the graph that y was created by. Leaf nodes are user-created Variables. In this case the only leaf node is x.
y = x ** 2

Since y is not a scalar here, we are giving the gradient wrt each output component y[0], y[1], y[2] etc. in the grad part of torch.autograd.backward. Hope that made it clearer.