I think backward() documentation 11 explains it pretty well, you can backward() on vector if you specify grad_tensor[s], that is a gradient of some vector-to-scalar function, if this argument consists of ones that’s the same as .sum().backward(), and a weighted sum otherwise.
As parameter.grad is for scalar-valued functions, reduction to a scalar is present one way or the other.