Skip to content
Permalink
Browse files

Convert metric tensor to a numeric value (#1732)

* Convert metric tensor to a numeric value

* Fix the evaluation service test
  • Loading branch information
workingloong committed Feb 14, 2020
1 parent 5a8ba88 commit 6448bb2d1de6d784cd2787529388ea958aba9cde
@@ -89,13 +89,13 @@ def get_evaluation_summary(self):
if self._model_have_multiple_outputs:
return {
output_name: {
metric_name: metric_inst.result()
metric_name: metric_inst.result().numpy()
for metric_name, metric_inst in metrics.items()
}
for output_name, metrics in self._metrics_dict.items()
}
return {
metric_name: metric_inst.result()
metric_name: metric_inst.result().numpy()
for metric_name, metric_inst in self._metrics_dict[
MetricsDictKey.MODEL_OUTPUT
].items()
@@ -78,13 +78,9 @@ def testEvaluationJob(self):
)
expected_acc = 0.25
evaluation_metrics = job.get_evaluation_summary()
self.assertAlmostEqual(
expected_acc, evaluation_metrics.get("acc").numpy()
)
self.assertAlmostEqual(
expected_acc, evaluation_metrics.get("acc_fn").numpy()
)
self.assertAlmostEqual(10.125, evaluation_metrics.get("mse").numpy())
self.assertAlmostEqual(expected_acc, evaluation_metrics.get("acc"))
self.assertAlmostEqual(expected_acc, evaluation_metrics.get("acc_fn"))
self.assertAlmostEqual(10.125, evaluation_metrics.get("mse"))

def testEvaluationService(self):
task_d = _TaskDispatcher(

0 comments on commit 6448bb2

Please sign in to comment.
You can’t perform that action at this time.