code: def forward(
      self,
      y_true: torch.Tensor,
      y_pred: torch.Tensor,
      sample_weight=None,
  ):
      if self.num_quantiles > 1:
          y_pred_all = torch.chunk(y_pred, self.num_quantiles, dim=-1)
      else:
          y_pred_all = [y_pred]
  
      qt_loss = []
      for i, y_pred_q in enumerate(y_pred_all):
          q = self.quantiles[i]
          weighted_qt = (
              self.compute_quantile_loss(
                  y_true, y_pred_q.squeeze(-1), q
              )
              * self.quantile_weights[i]
          )
          qt_loss.append(weighted_qt)
      stacked_qt_losses = torch.stack(qt_loss, dim=-1)
      sum_qt_loss = torch.mean(stacked_qt_losses, dim=-1)
      if sample_weight is not None:
          return sample_weight * sum
      else:
          return sum_qt_loss
  
file_path: gluonts/src/gluonts/nursery/robust-mts-attack/pts/model/tft/tft_output.py
imports: from typing import List, Optional, Tuple
  import numpy
  import torch
  import torch.nn
  from gluonts.core.component import validated
label_desc: Use image node_id 2 for calling the QuantileLoss obj's underlying member method code with example usage: obj.forward(y_true, y_pred, sample_weight) and returns: unknown, sum_qt_loss