Thank you for your response.
Ya I suspected that its number of elements but the document say that it is batch size so I got confused.
grad = loss.grad_fn(torch.tensor(1).float())

This seems to be computing gradient by calling Backward and multiply the value I provide (which is 1 in this example).