    def get_target_label(self, input, target_is_real):
        """Get target label.

        Args:
            input (Tensor): Input tensor.
            target_is_real (bool): Whether the target is real or fake.

        Returns:
            (bool | Tensor): Target tensor. Return bool for wgan, otherwise,
                return Tensor.
        """

        if self.gan_type in ['wgan', 'wgan_softplus']:
            return target_is_real
        target_val = (self.real_label_val if target_is_real else self.fake_label_val)
        return input.new_ones(input.size()) * target_val
Get target label.

Args:
input (Tensor): Input tensor.
target_is_real (bool): Whether the target is real or fake.

Returns:
(bool | Tensor): Target tensor. Return bool for wgan, otherwise,
return Tensor.
opensora/models/super_resolution/basicsr/losses/losses.py