I don’t believe your use case is different from what’s shown in the docs 28, aside from more explicit kwargs and outputs being a Tensor with (presumably) more than one element.  Perhaps, instead of

To implement a gradient penalty with gradient scaling, the loss passed to  torch.autograd.grad()  9 should be scaled.

the docs should say

To implement a gradient penalty with gradient scaling, the outputs Tensor(s) passed to  torch.autograd.grad()  9 should be scaled.

Try
with autocast():
    out = discrim(sample)

gradients = torch.autograd.grad(outputs=scaler.scale(out), inputs=sample,
    grad_outputs=torch.ones(out.shape, device=sample.device),
    create_graph=True, retain_graph=True, only_inputs=True)[0]

# proceed as shown in the docs

# if gradients is a Tensor
gradients = gradients / scaler.get_scale()
# if gradients is a tuple
inv_scale = 1./scaler.get_scale()
gradients = [p * inv_scale for p in gradients]

with autocast():
    # compute penalty term from gradients
    # add to loss if needed

scaler.scale(<loss or penalty>).backward()

If that works I will update docs as described above.
FYI in grad, retain_graph defaults to the value of create_graph and only_inputs defaults to True so these kwargs are not needed.  Also, I changed
torch.ones(out.shape).to(sample.device) to torch.ones(out.shape, device=sample.device) which synthesizes grad_outputs directly on the device, avoids an expensive CPU->GPU copy, and is good practice regardless of Amp.