code: def testRoundTripConversion(self, value_fn):
      value = value_fn()
      s = structure.type_spec_from_value(value)
  
      def maybe_stack_ta(v):
          if isinstance(v, tensor_array_ops.TensorArray):
              return v.stack()
          return v
  
      before = self.evaluate(maybe_stack_ta(value))
      after = self.evaluate(
          maybe_stack_ta(
              structure.from_tensor_list(
                  s, structure.to_tensor_list(s, value)
              )
          )
      )
  
      flat_before = nest.flatten(before)
      flat_after = nest.flatten(after)
      for b, a in zip(flat_before, flat_after):
          if isinstance(b, sparse_tensor.SparseTensorValue):
              self.assertAllEqual(b.indices, a.indices)
              self.assertAllEqual(b.values, a.values)
              self.assertAllEqual(b.dense_shape, a.dense_shape)
          elif isinstance(
              b,
              (
                  ragged_tensor.RaggedTensor,
                  ragged_tensor_value.RaggedTensorValue,
              ),
          ):
              self.assertAllEqual(b, a)
          else:
              self.assertAllEqual(b, a)
  
imports: import collections
  import dataclasses
  import functools
  from absl.testing import parameterized
  import numpy
  import wrapt
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.util import nest
  from tensorflow.python.data.util import structure
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import tensor_array_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.ops.ragged import ragged_factory_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.ops.ragged import ragged_tensor_value
  from tensorflow.python.platform import test
  from tensorflow.python.util.compat import collections_abc
label_desc: Use image node_id 6 for calling the StructureTest obj's underlying member method code with example usage: obj.testRoundTripConversion(value_fn) and returns: v, v