Add direct plotly figure reporting (see issue #136)

This commit is contained in:
allegroai
2020-06-14 00:01:30 +03:00
parent 8a5f6b7d02
commit 20a9f0997d
3 changed files with 84 additions and 30 deletions

View File

@@ -176,10 +176,16 @@ class Reporter(InterfaceBase, AbstractContextManager, SetupUploadMixin, AsyncMan
:param iter: Iteration number
:type value: int
"""
# noinspection PyBroadException
try:
def default(o):
if isinstance(o, np.int64):
return int(o)
# Special json encoder for numpy types
def default(obj):
if isinstance(obj, (np.integer, np.int64)):
return int(obj)
elif isinstance(obj, np.floating):
return float(obj)
elif isinstance(obj, np.ndarray):
return obj.tolist()
except Exception:
default = None