code: def assert_shape_and_finite(x, shape):
      assert x.shape == shape
      assert not np.isnan(x.asnumpy()).any()
      assert not np.isinf(x.asnumpy()).any()
  
file_path: gluonts/test/mx/distribution/test_lds.py
imports: import gzip
  import json
  import os
  import mxnet
  import numpy
  import pytest
  from gluonts.mx.distribution.lds import LDS
label_desc: Use image node_id 1 for calling a global function with example usage: assert_shape_and_finite(x, shape) without return types