code: def generic_equals(first: Any, second: Any) -> bool:
      if isinstance(first, Tensor):
          return isinstance(second, Tensor) and torch.equal(
              first, second
          )
      if isinstance(first, np.ndarray):
          return isinstance(second, np.ndarray) and np.array_equal(
              first, second, equal_nan=True
          )
      if isinstance(first, dict):
          return isinstance(second, dict) and generic_equals(
              sorted(first.items()), sorted(second.items())
          )
      if isinstance(first, (tuple, list)):
          if type(first) is not type(second) or len(first) != len(
              second
          ):
              return False
          for f, s in zip(first, second):
              if not generic_equals(f, s):
                  return False
          return True
      return first == second
  
imports: from typing import Any
  import numpy
  import torch
  from torch import Tensor
label_desc: Use image node_id 1 for calling a global function with example usage: generic_equals(first, second) and returns: unknown, unknown, unknown, unknown, True, False, False