code: def assert_shape(x: Tensor, expected_shape: Tuple[int, ...]):
      """
      Assert expected shape if mode is mx.nd.
  
      Parameters
      ----------
      x
          Input Tensor
      expected_shape
          Expected shape
      Returns
      -------
      """
      if isinstance(x, mx.nd.NDArray):
          for i, j in zip(x.shape, expected_shape):
              if j != -1:
                  assert (
                      i == j
                  ), f"shape mismatch got {x.shape} expected {expected_shape}"
  
imports: import inspect
  import tempfile
  from pathlib import Path
  from typing import List, Optional, Tuple, cast, Type
  import mxnet
  from mxnet.gluon.block import _flatten
  from gluonts.core.serde import dump_json, load_json
  from gluonts.mx import Tensor
label_desc: Use image node_id 1 for calling a global function with example usage: assert_shape(x, expected_shape) without return types