code: def assert_shape(tensor, name, expected_shape):
      if tensor is not None:
          if isinstance(expected_shape, list):
              expected_shape = torch.Size(expected_shape)
          assert isinstance(expected_shape, torch.Size)
          shape = tensor.shape
          if shape != expected_shape:
              raise ValueError(
                  f"{name}'s shape is invalid (Expected one of {expected_shape}, got {shape})"
              )
  
imports: import numpy
  import time
  import torch
label_desc: Use image node_id 4 for calling a global function with example usage: assert_shape(tensor, name, expected_shape) without return types