Fix json serialization in Lambda layer
diff --git a/keras/layers/core.py b/keras/layers/core.py
index 0846d0880b1..e5b9aa69b01 100644
--- a/keras/layers/core.py
+++ b/keras/layers/core.py
@@ -460,9 +460,9 @@ def get_config(self):
 
         if isinstance(self._output_shape, python_types.LambdaType):
             if py3:
-                output_shape = marshal.dumps(self._output_shape.__code__)
+                output_shape = marshal.dumps(self._output_shape.__code__).decode('raw_unicode_escape')
             else:
-                output_shape = marshal.dumps(self._output_shape.func_code)
+                output_shape = marshal.dumps(self._output_shape.func_code).decode('raw_unicode_escape')
             output_shape_type = 'lambda'
         elif callable(self._output_shape):
             output_shape = self._output_shape.__name__
@@ -494,7 +494,7 @@ def from_config(cls, config):
         if output_shape_type == 'function':
             output_shape = globals()[config['output_shape']]
         elif output_shape_type == 'lambda':
-            output_shape = marshal.loads(config['output_shape'])
+            output_shape = marshal.loads(config['output_shape'].encode('raw_unicode_escape'))
             output_shape = python_types.FunctionType(output_shape, globals())
         else:
             output_shape = config['output_shape']

Fix #2582 
Fix #3001

here is a sample code: https://gist.github.com/henry0312/e183da836489eb9a548a9bd095ec9bbb
