mirror of
https://github.com/clearml/clearml
synced 2025-01-31 09:07:00 +00:00
Fix python 2.7/3.5 math support
This commit is contained in:
parent
1651faac3d
commit
4aa5c620f4
@ -195,11 +195,12 @@ class Reporter(InterfaceBase, AbstractContextManager, SetupUploadMixin, AsyncMan
|
||||
:type round_digits: int
|
||||
"""
|
||||
def floatstr(o):
|
||||
inf_value = math.inf if six.PY3 else float("inf")
|
||||
if o != o:
|
||||
return 'nan'
|
||||
elif o == math.inf:
|
||||
elif o == inf_value:
|
||||
return 'inf'
|
||||
elif o == -math.inf:
|
||||
elif o == -inf_value:
|
||||
return '-inf'
|
||||
return round(o, ndigits=round_digits) if round_digits is not None else o
|
||||
|
||||
|
@ -344,9 +344,9 @@ class Logger(object):
|
||||
reporter_table = table
|
||||
else:
|
||||
reporter_table = table.fillna(str(np.nan))
|
||||
replace("NaN", np.nan, math.nan)
|
||||
replace("Inf", np.inf, math.inf)
|
||||
replace("-Inf", -np.inf, np.NINF, -math.inf)
|
||||
replace("NaN", np.nan, math.nan if six.PY3 else float("nan"))
|
||||
replace("Inf", np.inf, math.inf if six.PY3 else float("inf"))
|
||||
replace("-Inf", -np.inf, np.NINF, -math.inf if six.PY3 else -float("inf"))
|
||||
# noinspection PyProtectedMember
|
||||
return self._task._reporter.report_table(
|
||||
title=title,
|
||||
|
Loading…
Reference in New Issue
Block a user