class_docstr: Tests average recoder.
      
class_docstr_tok: ["Tests","average","recoder","."]
docstr: Tests :class:`~texar.tf.utils.AverageRecorder`
          
docstr_tok: ["Tests",":","class",":","`","~texar.tf.utils.AverageRecorder","`"]
code: def test_average_recorder(self):
      """Tests :class:`~texar.tf.utils.AverageRecorder`"""
      recorder = AverageRecorder(5)
      for i in range(100):
          self.assertEqual(recorder.add([1.0, 2.0]), [1.0, 2.0])
          self.assertEqual(recorder.add([1.0]), [1.0, 2.0])
          self.assertEqual(recorder.avg(), [1.0, 2.0])
          self.assertEqual(recorder.avg(0), 1.0)
          self.assertEqual(recorder.avg(1), 2.0)
          self.assertEqual(recorder.avg([0, 1]), [1.0, 2.0])
  
      recorder = AverageRecorder()
      for i in range(100):
          self.assertEqual(
              recorder.add({"1": 1, "2": 2}), {"1": 1.0, "2": 2.0}
          )
          self.assertEqual(recorder.add({"1": 1}), {"1": 1.0, "2": 2.0})
          self.assertEqual(recorder.avg(), {"1": 1.0, "2": 2.0})
          self.assertEqual(recorder.avg("1"), 1.0)
          self.assertEqual(recorder.avg("2"), 2.0)
          self.assertEqual(
              recorder.avg(["1", "2"]), {"1": 1.0, "2": 2.0}
          )
  
imports: import tensorflow
  from texar.tf.utils.average_recorder import _SingleAverageRecorder, AverageRecorder
label_desc: Use image node_id 2 for calling the AverageRecorderTest obj's underlying member method code with example usage: obj.test_average_recorder() without return types