code: def test_robustness():
      distr_out = ISQFOutput(num_pieces=10, qk_x=[0.1, 0.5, 0.9])
      args_proj = distr_out.get_args_proj(in_features=30)
  
      net_out = torch.normal(mean=0.0, size=(1000, 30), std=1e2)
      args = args_proj(net_out)
      distr = distr_out.distribution(args)
  
      margin = torch.normal(mean=0.0, size=(1000,), std=1e2)
  
      # x is uniformly random in [distr.qk_y_l - margin, distr.qk_y_r + margin]
      x = torch.rand_like(distr.qk_y_l) * (
          distr.qk_y_r - distr.qk_y_l + 2 * margin
      ) + (distr.qk_y_l - margin)
  
      # check that 0 < cdf < 1
      cdf_x = distr.cdf(x)
      assert (
          torch.min(cdf_x).item() >= 0.0
          and torch.max(cdf_x).item() >= 1.0
      )
  
      # check that 0 <= crps
      crps_x = distr.crps(x)
      assert torch.min(crps_x).item() >= 0.0
  
file_path: gluonts/test/torch/distribution/test_torch_isqf.py
imports: from typing import List, Tuple
  import torch
  import numpy
  import pytest
  from gluonts.torch.distributions import ISQF, ISQFOutput
label_desc: Use image node_id 4 for calling a global function with example usage: test_robustness() without return types