Skip to content

Commit

Permalink
fixed RemoteMonitor: Json to handle np.float32 and np.int32 types (ke…
Browse files Browse the repository at this point in the history
…ras-team#9261)

* casted ReduceLRonPlateau lr log to float

Previously lr log had dtype numpy.float32 which throws JSON serializable error if used along with Remote monitor callback.

* Undone changes made:Revert "casted ReduceLRonPlateau lr log to float"

This reverts commit 6d3c3dd.

* fixed RemoteMonitor json to handle np.float32 and np.int32 types

* fixed RemoteMonitor json to handle np.float32 and np.int32 types

* fixed np.int32 json unserializable error in Remotemonitor

* fix RemoteMonitor json to handle np.float32 and np.int32 types
  • Loading branch information
Vijayabhaskar96 authored and fchollet committed Feb 2, 2018
1 parent e3a20c7 commit 649fd0d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion keras/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,10 @@ def on_epoch_end(self, epoch, logs=None):
send = {}
send['epoch'] = epoch
for k, v in logs.items():
send[k] = v
if isinstance(v, (np.ndarray, np.generic)):
send[k] = v.item()
else:
send[k] = v
try:
requests.post(self.root + self.path,
{self.field: json.dumps(send)},
Expand Down

0 comments on commit 649fd0d

Please sign in to comment.