From e722559bdd77b14445f06dce7a0b6c173cf50195 Mon Sep 17 00:00:00 2001 From: Tsukasa OMOTO Date: Tue, 31 May 2016 11:43:36 +0900 Subject: [PATCH] Fix json serialization in merge layer Fix #2818 --- keras/engine/topology.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keras/engine/topology.py b/keras/engine/topology.py index 7f971567aa4..8c5ebaa45e9 100644 --- a/keras/engine/topology.py +++ b/keras/engine/topology.py @@ -1327,9 +1327,9 @@ def get_config(self): if isinstance(self.mode, python_types.LambdaType): if py3: - mode = marshal.dumps(self.mode.__code__) + mode = marshal.dumps(self.mode.__code__).decode('raw_unicode_escape') else: - mode = marshal.dumps(self.mode.func_code) + mode = marshal.dumps(self.mode.func_code).decode('raw_unicode_escape') mode_type = 'lambda' elif callable(self.mode): mode = self.mode.__name__ @@ -1365,7 +1365,7 @@ def from_config(cls, config): if mode_type == 'function': mode = globals()[config['mode']] elif mode_type == 'lambda': - mode = marshal.loads(config['mode']) + mode = marshal.loads(config['mode'].encode('raw_unicode_escape')) mode = python_types.FunctionType(mode, globals()) else: mode = config['mode']