code: def assert_shape_eq(x, expected_shape, err_msg=""):
      if isinstance(x, torch.Tensor):
          shape = x.size()
      elif isinstance(x, np.ndarray):
          shape = x.shape
      else:
          raise Exception(
              f"Not sure how to take shape for type {type(x)}: {x}"
          )
  
      assert shape == tuple(
          expected_shape
      ), f"{err_msg or 'assert_shape_eq fail'}: {shape} != {tuple(expected_shape)}"
  
file_path: summarize-from-feedback/summarize_from_feedback/utils/assertions.py
imports: import numpy
  import numpy.testing
  import torch
  from summarize_from_feedback.utils.torch_utils import to_numpy
label_desc: Use image node_id 5 for calling a global function with example usage: assert_shape_eq(x, expected_shape, err_msg) without return types