code: def assert_equal(actual, expected, prec=1e-5, msg=""):
      if prec > 0.0:
          return assert_close(actual, expected, atol=prec, msg=msg)
      if not msg:
          msg = "{} vs {}".format(actual, expected)
      if isinstance(actual, numbers.Number) and isinstance(
          expected, numbers.Number
      ):
          assert actual == expected, msg
      # Placing this as a second check allows for coercing of numeric types above;
      # this can be moved up to harden type checks.
      elif type(actual) != type(expected):
          raise AssertionError(
              "cannot compare {} and {}".format(
                  type(actual), type(expected)
              )
          )
      elif torch.is_tensor(actual) and torch.is_tensor(expected):
          assert actual.is_sparse == expected.is_sparse, msg
          if actual.is_sparse:
              x = _safe_coalesce(actual)
              y = _safe_coalesce(expected)
              assert_tensors_equal(x._indices(), y._indices(), msg=msg)
              assert_tensors_equal(x._values(), y._values(), msg=msg)
          else:
              assert_tensors_equal(actual, expected, msg=msg)
      elif type(actual) == np.ndarray and type(actual) == np.ndarray:
          assert (actual == expected).all(), msg
      elif isinstance(actual, dict):
          assert set(actual.keys()) == set(expected.keys())
          for key, x_val in actual.items():
              assert_equal(
                  x_val,
                  expected[key],
                  prec=0.0,
                  msg="At key{}: {} vs {}".format(
                      key, x_val, expected[key]
                  ),
              )
      elif isinstance(actual, str):
          assert actual == expected, msg
      elif is_iterable(actual) and is_iterable(expected):
          assert len(actual) == len(expected), msg
          for xi, yi in zip(actual, expected):
              assert_equal(
                  xi, yi, prec=0.0, msg="{} vs {}".format(xi, yi)
              )
      else:
          assert actual == expected, msg
  
imports: import contextlib
  import numbers
  import os
  import re
  import warnings
  from itertools import product
  import numpy
  import pytest
  import torch
  import torch.cuda
  from numpy.testing import assert_allclose
  from pytest import approx
label_desc: Use image node_id 15 for calling a global function with example usage: assert_equal(actual, expected, prec, msg) and returns: assert_close