(self)
| 662 | self.assertLess(test_runner.global_step, 10) |
| 663 | |
| 664 | def test_evaluate_with_loss_output(self): |
| 665 | test_evaluator = TestEvaluator() |
| 666 | |
| 667 | checkpoint = tf.train.Checkpoint(model=test_evaluator.model) |
| 668 | checkpoint.save(os.path.join(self.model_dir, "ckpt")) |
| 669 | checkpoint_manager = tf.train.CheckpointManager( |
| 670 | checkpoint, self.model_dir, max_to_keep=None) |
| 671 | test_controller = controller.Controller( |
| 672 | evaluator=test_evaluator, |
| 673 | global_step=tf.Variable(0, dtype=tf.int64), |
| 674 | checkpoint_manager=checkpoint_manager, |
| 675 | eval_summary_dir=os.path.join(self.model_dir, "summaries/eval")) |
| 676 | test_controller.evaluate(steps=5) |
| 677 | |
| 678 | # Only eval summaries are written |
| 679 | self.assertNotEmpty( |
| 680 | tf.io.gfile.listdir(os.path.join(self.model_dir, "summaries/eval"))) |
| 681 | self.assertNotEmpty( |
| 682 | summaries_with_matching_keyword( |
| 683 | "eval_loss", os.path.join(self.model_dir, "summaries/eval"))) |
| 684 | |
| 685 | def test_evaluate_with_no_output(self): |
| 686 | test_controller = controller.Controller( |
nothing calls this directly
no test coverage detected