code: def _testEditDistance(
      self,
      hypothesis,
      truth,
      normalize,
      expected_output,
      expected_err_re=None,
  ):
      # Shape inference figures out the shape from the shape variables
      # Explicit tuple() needed since zip returns an iterator in Python 3.
      expected_shape = [
          max(h, t) for h, t in tuple(zip(hypothesis[2], truth[2]))[:-1]
      ]
  
      # SparseTensorValue inputs.
      with ops.Graph().as_default() as g, self.session(g):
          # hypothesis and truth are (index, value, shape) tuples
          self._testEditDistanceST(
              hypothesis_st=sparse_tensor.SparseTensorValue(
                  *[ConstantOf(x) for x in hypothesis]
              ),
              truth_st=sparse_tensor.SparseTensorValue(
                  *[ConstantOf(x) for x in truth]
              ),
              normalize=normalize,
              expected_output=expected_output,
              expected_shape=expected_shape,
              expected_err_re=expected_err_re,
          )
  
      # SparseTensor inputs.
      with ops.Graph().as_default() as g, self.session(g):
          # hypothesis and truth are (index, value, shape) tuples
          self._testEditDistanceST(
              hypothesis_st=sparse_tensor.SparseTensor(
                  *[ConstantOf(x) for x in hypothesis]
              ),
              truth_st=sparse_tensor.SparseTensor(
                  *[ConstantOf(x) for x in truth]
              ),
              normalize=normalize,
              expected_output=expected_output,
              expected_shape=expected_shape,
              expected_err_re=expected_err_re,
          )
  
imports: import numpy
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.ops import array_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 2 for calling the EditDistanceTest obj's underlying member method code with example usage: obj._testEditDistance(hypothesis, truth, normalize, expected_output, expected_err_re) without return types