def test_collect_run_params(self):
    run_info = {}
    run_parameters = {
        "batch_size": 32,
        "synthetic_data": True,
        "train_epochs": 100.00,
        "dtype": "fp16",
        "resnet_size": 50,
        "random_tensor": tf.constant(2.0)
    }
    logger._collect_run_params(run_info, run_parameters)
    self.assertEqual(len(run_info["run_parameters"]), 6)
    self.assertEqual(run_info["run_parameters"][0],
                     {"name": "batch_size", "long_value": 32})
    self.assertEqual(run_info["run_parameters"][1],
                     {"name": "dtype", "string_value": "fp16"})
    v1_tensor = {"name": "random_tensor", "string_value":
                     "Tensor(\"Const:0\", shape=(), dtype=float32)"}
    v2_tensor = {"name": "random_tensor", "string_value":
                     "tf.Tensor(2.0, shape=(), dtype=float32)"}
    self.assertIn(run_info["run_parameters"][2], [v1_tensor, v2_tensor])


    self.assertEqual(run_info["run_parameters"][3],
                     {"name": "resnet_size", "long_value": 50})
    self.assertEqual(run_info["run_parameters"][4],
                     {"name": "synthetic_data", "bool_value": "True"})
    self.assertEqual(run_info["run_parameters"][5],
                     {"name": "train_epochs", "float_value": 100.00})
Esempio n. 2
0
 def test_collect_run_params(self):
   run_info = {}
   run_parameters = {
       "batch_size": 32,
       "synthetic_data": True,
       "train_epochs": 100.00,
       "dtype": "fp16",
       "resnet_size": 50,
       "random_tensor": tf.constant(2.0)
   }
   logger._collect_run_params(run_info, run_parameters)
   self.assertEqual(len(run_info["run_parameters"]), 6)
   self.assertEqual(run_info["run_parameters"][0],
                    {"name": "batch_size", "long_value": 32})
   self.assertEqual(run_info["run_parameters"][1],
                    {"name": "dtype", "string_value": "fp16"})
   self.assertEqual(run_info["run_parameters"][2],
                    {"name": "random_tensor", "string_value":
                         "Tensor(\"Const:0\", shape=(), dtype=float32)"})
   self.assertEqual(run_info["run_parameters"][3],
                    {"name": "resnet_size", "long_value": 50})
   self.assertEqual(run_info["run_parameters"][4],
                    {"name": "synthetic_data", "bool_value": "True"})
   self.assertEqual(run_info["run_parameters"][5],
                    {"name": "train_epochs", "float_value": 100.00})