class_docstr: A baseclass for testing transforms.
class_docstr_tok: ["A","baseclass","for","testing","transforms","."]
docstr: A wrapper that picks assertion based on tensor dtype.
docstr_tok: ["A","wrapper","that","picks","assertion","based","on","tensor","dtype","."]
code: def _assert_tensors_equal(self, v1, v2, msg=""):
      """A wrapper that picks assertion based on tensor dtype."""
      self.assertEqual(v1.dtype, v2.dtype, msg=f"{msg}: Dtype mismatch")
  
      if (
          v1.dtype == tf.bool
          or v1.dtype == tf.int32
          or v1.dtype == tf.int64
      ):
          # exact match for these data types
          self.assertTrue(np.all(np.equal(v1, v2)), msg=msg)
      elif v1.dtype == tf.float32 or v1.dtype == tf.float64:
          # approximate match for all others
          np.testing.assert_allclose(
              v1, v2, equal_nan=False, err_msg=msg, rtol=5e-5
          )
      else:
          raise NotImplementedError(f"{v1.dtype} type not supported.")
  
imports: import copy
  from absl.testing import absltest
  from absl.testing import parameterized
  import numpy
  from scenic.projects.baselines.detr import transforms
  import tensorflow
label_desc: Use image node_id 1 for calling the TransformsTestBase obj's underlying member method code with example usage: obj._assert_tensors_equal(v1, v2, msg) without return types