I kind of understand that when there is no argument passed in .backward(), it means the gradient that we want to compute is a scaler tensor, otherwise there would be an error.  However, today I read a code that works with no argument in .backward() for a vector tensor. Does anyone knows why this works?
I paste a snippet here
loss = F.binary_cross_entropy_with_logits(xbhat, xb, size_average=False) / B
loss.backward()

where xbhat is predicted values and xb are original mnist data