added type-normalization to metrics logger
should fix
# coding=utf-8
import datetime
import sys
+import sacred.optional as opt
if sys.version_info[0] == 2:
from Queue import Queue, Empty
@@ -39,6 +40,10 @@ class MetricsLogger(object):
If not specified, an internal counter for each metric
is used, incremented by one.
"""
+ if opt.has_numpy:
+ np = opt.np
+ if isinstance(value, np.generic):
+ value = np.asscalar(value)
if step is None:
step = self._metric_step_counter.get(metric_name, -1) + 1
self._logged_metrics.put(
