// dimension? One way, involving names, would be to name the ``per_batch_scale``
// tensor such that it matches ``imgs.names``, as shown below.
imgs = torch.randn(6, 6, 6, 6, names=("N", "C", "H", "W"))
per_batch_scale_4d = torch.rand(6, 1, 1, 1, names=("N", "C", "H", "W"))
print((imgs * per_batch_scale_4d).names)
After Change
loss.backward(grad_loss)
correct_grad = weight.grad.clone()
print(correct_grad) // Unnamed for now. Will be named in the future
weight.grad.zero_()
grad_loss = grad_loss.refine_names("C")