class_docstr: Mixin for specialized asserts.
class_docstr_tok: ["Mixin","for","specialized","asserts","."]
docstr: Asserts that flattened results are equal.
  
  Due to the number of replicas in the strategy, the output may have a
  different structure and needs to be flattened for comparison.
  
  Args:
    expected_results: The results expected as a result of a computation.
    actual_results: The actual results of a computation.
docstr_tok: ["Asserts","that","flattened","results","are","equal",".","Due","to","the","number","of","replicas","in","the","strategy",",","the","output","may","have","a","different","structure","and","needs","to","be","flattened","for","comparison",".","Args",":","expected_results",":","The","results","expected","as","a","result","of","a","computation",".","actual_results",":","The","actual","results","of","a","computation","."]
code: def assert_equal_flattened(self, expected_results, actual_results):
      """Asserts that flattened results are equal.
  
      Due to the number of replicas in the strategy, the output may have a
      different structure and needs to be flattened for comparison.
  
      Args:
        expected_results: The results expected as a result of a computation.
        actual_results: The actual results of a computation.
      """
      self.assertEqual(len(expected_results), len(actual_results))
  
      for i, expected_result in enumerate(expected_results):
          final_result = []
          actual_result = actual_results[i]
          for val in actual_result:
              final_result.extend(val.numpy())
          self.assertAllEqual(expected_result, final_result)
  
imports: from absl.testing import parameterized
  from tensorflow.python import tf2
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.distribute import combinations
  from tensorflow.python.distribute import device_util
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.distribute import reduce_util
  from tensorflow.python.distribute import strategy_combinations
  from tensorflow.python.distribute import test_util
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import test
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_assert
  from tensorflow.python.ops import map_fn
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.ops.losses import losses
  from tensorflow.python.tpu import tpu
  from tensorflow.python.util import nest
label_desc: Use image node_id 1 for calling the AssertFlattenedMixin obj's underlying member method code with example usage: obj.assert_equal_flattened(expected_results, actual_results) without return types