code: def test_compute_quantile_loss(
      quantile_weights, correct_qt_loss
  ) -> None:
      y_true = nd.ones(shape=(10, 10, 10))
      y_pred = nd.zeros(shape=(10, 10, 10, 2))
  
      quantiles = [0.5, 0.9]
  
      loss = QuantileLoss(quantiles, quantile_weights)
      tol = 1e-5
      if not quantile_weights:
          for idx, q in enumerate(quantiles):
              assert (
                  nd.mean(
                      loss.compute_quantile_loss(
                          nd.ndarray, y_true, y_pred[:, :, :, idx], q
                      )
                  )
                  - correct_qt_loss[idx]
                  < tol
              ), f"computing quantile loss at quantile {q} fails!"
      else:
          assert (
              nd.mean(loss(y_true, y_pred)) - correct_qt_loss < tol
          ), "computing weighted quantile loss fails!"
  
file_path: gluonts/test/mx/model/seq2seq/test_quantile_loss.py
imports: from mxnet import nd
  import pytest
  import numpy
  from pandas import Period
  from gluonts.mx.block.quantile_output import QuantileLoss, crps_weights_pwl
  from gluonts.model.forecast import QuantileForecast
label_desc: Use image node_id 1 for calling a global function with example usage: test_compute_quantile_loss(quantile_weights, correct_qt_loss) without return types