class_docstr: Base class for the reference tests.
class_docstr_tok: ["Base","class","for","the","reference","tests","."]
docstr: Compares two possibly-nested structures.
docstr_tok: ["Compares","two","possibly-nested","structures","."]
code: def _deep_equal(self, left, right):
      """Compares two possibly-nested structures."""
      if isinstance(left, tf.Tensor):
          return self._deep_equal(left.numpy(), right)
      if isinstance(right, tf.Tensor):
          return self._deep_equal(left, right.numpy())
      if isinstance(left, tf.SparseTensor) and isinstance(
          right, tf.SparseTensor
      ):
          return (
              self._deep_equal(left.indices, right.indices)
              and self._deep_equal(left.values, right.values)
              and self._deep_equal(left.shape, right.shape)
          )
      if isinstance(left, np.ndarray) or isinstance(right, np.ndarray):
          return np.array_equal(left, right)
      if isinstance(left, (list, tuple)) and isinstance(
          right, (list, tuple)
      ):
          return all(
              self._deep_equal(l, r) for l, r in zip(left, right)
          )
      return left == right
  
imports: import io
  import numbers
  import os
  import sys
  import traceback
  import numpy
  import tensorflow
label_desc: Use image node_id 5 for calling the TestCase obj's underlying member method code with example usage: obj._deep_equal(left, right) and returns: unknown, self, self, unknown, np, all