If you’re using momentum and/or weight decay (or another optimizer) it won’t work.
For example SGD+weight decay (with learning rate lr and weight_decay wd will do the following update: w = w - lr * (dL/dw + wd*w). You can see that scaling your loss: dL/dw -> 1/n*dL/dw will not have the same effect as changing the learning rate lr -> 1/n*lr: the weight decay term will not be scaled the same way.
For other optimizer, you will need to check the formula of the update and see if scaling of the gradient and of the learning rate have the same effect on the update or not (it is really unlikely).