class_docstr: Projected Gradient Descent is an iterative version of the one-step attack
  FGSM that can generate adversarial examples. It takes multiple gradient
  steps to search for an adversarial perturbation within the desired
  neighbor ball around the original inputs. In a non-targeted attack, the
  formulation is::
  
      x_0 = x
      x_(t+1) = Clip_r(x_t + alpha * sign(gradient of L(theta, x, t)))
  
  where Clip denotes the function that projects its argument to the r-neighbor
  ball around x so that the perturbation will be bounded. Alpha is the step
  size. L(theta, x, y) is the model's loss function with respect to model
  parameters, inputs and targets.
  In a targeted attack, the formulation is similar::
  
      x_0 = x
      x_(t+1) = Clip_r(x_t - alpha * sign(gradient of L(theta, x, t)))
  
  More details on Projected Gradient Descent can be found in the original
  paper: https://arxiv.org/abs/1706.06083
docstr: A helper function that returns a uniform random point within the ball
  with the given center and radius. Norm should be either L2 or Linf.
docstr_tok: ["A","helper","function","that","returns","a","uniform","random","point","within","the","ball","with","the","given","center","and","radius",".","Norm","should","be","either","L2","or","Linf","."]
code: def _random_point(
      self,
      center: Tensor,
      radius: float,
      norm: str,
      mask: Union[Tensor, int],
  ) -> Tensor:
      r"""
      A helper function that returns a uniform random point within the ball
      with the given center and radius. Norm should be either L2 or Linf.
      """
      if norm == "L2":
          u = torch.randn_like(center)
          unit_u = F.normalize(u.view(u.size(0), -1)).view(u.size())
          d = torch.numel(center[0])
          r = (torch.rand(u.size(0)) ** (1.0 / d)) * radius
          r = r[(...,) + (None,) * (r.dim() - 1)]
          x = r * unit_u
          return center + (x * mask)
      elif norm == "Linf":
          x = torch.rand_like(center) * radius * 2 - radius
          return center + (x * mask)
      else:
          raise AssertionError("Norm constraint must be L2 or Linf.")
  
file_path: captum/captum/robust/_core/pgd.py
imports: from typing import Any, Callable, Optional, Tuple, Union
  import torch
  import torch.nn.functional
  from captum._utils.common import _format_output, _format_tensor_into_tuples, _is_tuple
  from captum._utils.typing import TensorOrTupleOfTensorsGeneric
  from captum.log import log_usage
  from captum.robust._core.fgsm import FGSM
  from captum.robust._core.perturbation import Perturbation
  from torch import Tensor
label_desc: Use image node_id 3 for calling the PGD obj's underlying member method code with example usage: obj._random_point(center, radius, norm, mask) and returns: unknown, unknown