class_docstr: Class for the PinBall loss for quantile regression
class_docstr_tok: ["Class","for","the","PinBall","loss","for","quantile","regression"]
docstr: Computes the pinball loss from forecasts
  Args:
      outputs : torch.tensor
          outputs from the model of dims (batch, no_quantiles, n_forecasts)
      target : torch.tensor
          actual targets of dims (batch, n_forecasts)
  
  Returns:
      float
          pinball loss
docstr_tok: ["Computes","the","pinball","loss","from","forecasts","Args",":","outputs",":","torch.tensor","outputs","from","the","model","of","dims","(","batch",",","no_quantiles",",","n_forecasts",")","target",":","torch.tensor","actual","targets","of","dims","(","batch",",","n_forecasts",")","Returns",":","float","pinball","loss"]
code: def forward(self, outputs, target):
      """
      Computes the pinball loss from forecasts
      Args:
          outputs : torch.tensor
              outputs from the model of dims (batch, no_quantiles, n_forecasts)
          target : torch.tensor
              actual targets of dims (batch, n_forecasts)
  
      Returns:
          float
              pinball loss
      """
      target = target.repeat(
          1, 1, len(self.quantiles)
      )  # increase the quantile dimension of the targets
      differences = target - outputs
      base_losses = self.loss_func(
          outputs, target
      )  # dimensions - [n_batch, n_forecasts, no. of quantiles]
      positive_losses = (
          torch.tensor(self.quantiles, device=target.device)
          .unsqueeze(dim=0)
          .unsqueeze(dim=0)
          * base_losses
      )
      negative_losses = (
          1
          - torch.tensor(self.quantiles, device=target.device)
          .unsqueeze(dim=0)
          .unsqueeze(dim=0)
      ) * base_losses
      pinball_losses = torch.where(
          differences >= 0, positive_losses, negative_losses
      )
      multiplier = torch.ones(
          size=(1, 1, len(self.quantiles)), device=target.device
      )
      multiplier[:, :, 0] = 2
      pinball_losses = (
          multiplier * pinball_losses
      )  # double the loss for the median quantile
      return pinball_losses
  
imports: import torch
  from torch.nn.modules.loss import _Loss
label_desc: Use image node_id 2 for calling the PinballLoss obj's underlying member method code with example usage: obj.forward(outputs, target) and returns: pinball_losses