code: def _default_tolerance(dtype):
      """Returns a sensible default tolerance for comparing results of a given type.
  
      Args:
        dtype: A datatype.
      """
      if dtype == dtypes_lib.bfloat16.as_numpy_dtype:
          return 5e-3
      if dtype == np.float16:
          return 5e-3
      elif dtype in (np.float32, np.complex64):
          return 1e-3
      elif dtype in (np.float64, np.complex128):
          return 1e-5
      else:
          return None
  
imports: import math
  import numpy
  from tensorflow.python.eager import backprop
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import gen_math_ops
  from tensorflow.python.ops import gradient_checker
  from tensorflow.python.ops import gradient_checker_v2
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_grad
  from tensorflow.python.ops import special_math_ops
  from tensorflow.python.platform import test
  from tensorflow.python.platform import tf_logging
label_desc: Use image node_id 2 for calling a global function with example usage: _default_tolerance(dtype) and returns: int, int, int, int, None