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 strategy_combinations
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import test
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variables
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