code: def test_robustness():
      distr_out = PiecewiseLinearOutput(num_pieces=10)
      args_proj = distr_out.get_args_proj()
      args_proj.initialize()
  
      net_out = mx.nd.random.normal(shape=(1000, 30), scale=1e2)
      gamma, slopes, knot_spacings = args_proj(net_out)
      distr = distr_out.distribution((gamma, slopes, knot_spacings))
  
      # compute the 1-quantile (the 0-quantile is gamma)
      sup_support = gamma + mx.nd.sum(slopes * knot_spacings, axis=-1)
  
      assert (
          mx.nd.broadcast_lesser_equal(gamma, sup_support)
          .asnumpy()
          .all()
      )
  
      width = sup_support - gamma
      x = mx.random.uniform(low=gamma - width, high=sup_support + width)
  
      # check that 0 < cdf < 1
      cdf_x = distr.cdf(x)
      assert (
          mx.nd.min(cdf_x).asscalar() >= 0.0
          and mx.nd.max(cdf_x).asscalar() <= 1.0
      )
  
      # check that 0 <= crps
      crps_x = distr.crps(x)
      assert mx.nd.min(crps_x).asscalar() >= 0.0
  
file_path: gluonts/test/mx/distribution/test_piecewise_linear.py
imports: from typing import List, Tuple
  import mxnet
  import numpy
  import pytest
  from gluonts.core.serde import dump_json, load_json
  from gluonts.mx.distribution import FixedKnotsPiecewiseLinearOutput, PiecewiseLinear, PiecewiseLinearOutput
  from gluonts.testutil import empirical_cdf
label_desc: Use image node_id 4 for calling a global function with example usage: test_robustness() without return types