class_docstr: Calculates an adversarial loss on a Patch Discriminator or a Multi-scale Patch Discriminator.
  Warning: due to the possibility of using different criterions, the output of the discrimination
  mustn't be passed to a final activation layer. That is taken care of internally within the loss.
  
  Args:
      reduction: {``"none"``, ``"mean"``, ``"sum"``}
          Specifies the reduction to apply to the output. Defaults to ``"mean"``.
  
          - ``"none"``: no reduction will be applied.
          - ``"mean"``: the sum of the output will be divided by the number of elements in the output.
          - ``"sum"``: the output will be summed.
  
      criterion: which criterion (hinge, least_squares or bce) you want to use on the discriminators outputs.
          Depending on the criterion, a different activation layer will be used. Make sure you don't run the outputs
          through an activation layer prior to calling the loss.
      no_activation_leastsq: if True, the activation layer in the case of least-squares is removed.
docstr: Gets the ground truth tensor for the discriminator depending on whether the input is real or fake.
  
  Args:
      input: input tensor from the discriminator (output of discriminator, or output of one of the multi-scale
      discriminator). This is used to match the shape.
      target_is_real: whether the input is real or wannabe-real (1s) or fake (0s).
  Returns:
docstr_tok: ["Gets","the","ground","truth","tensor","for","the","discriminator","depending","on","whether","the","input","is","real","or","fake",".","Args",":","input",":","input","tensor","from","the","discriminator","(","output","of","discriminator",",","or","output","of","one","of","the","multi-scale","discriminator",")",".","This","is","used","to","match","the","shape",".","target_is_real",":","whether","the","input","is","real","or","wannabe-real","(","1s",")","or","fake","(","0s",")",".","Returns",":"]
code: def get_target_tensor(
      self, input: torch.Tensor, target_is_real: bool
  ) -> torch.Tensor:
      """
      Gets the ground truth tensor for the discriminator depending on whether the input is real or fake.
  
      Args:
          input: input tensor from the discriminator (output of discriminator, or output of one of the multi-scale
          discriminator). This is used to match the shape.
          target_is_real: whether the input is real or wannabe-real (1s) or fake (0s).
      Returns:
      """
      filling_label = (
          self.real_label if target_is_real else self.fake_label
      )
      label_tensor = (
          torch.tensor(1)
          .fill_(filling_label)
          .type(input.type())
          .to(input[0].device)
      )
      label_tensor.requires_grad_(False)
      return label_tensor.expand_as(input)
  
file_path: MONAI/monai/losses/adversarial_loss.py
imports: from __future__ import annotations
  import warnings
  import torch
  from torch.nn.modules.loss import _Loss
  from monai.networks.layers.utils import get_act_layer
  from monai.utils import LossReduction
  from monai.utils.enums import StrEnum
label_desc: Use image node_id 2 for calling the PatchAdversarialLoss obj's underlying member method code with example usage: obj.get_target_tensor(input, target_is_real) and returns: label_tensor