

def get_config(self):
    py3 = (sys.version_info[0] == 3)
    if isinstance(self.function, python_types.LambdaType):
        if py3:
            function = marshal.dumps(self.function.__code__).decode('raw_unicode_escape')
        else:
            function = marshal.dumps(self.function.func_code).decode('raw_unicode_escape')
        function_type = 'lambda'
    else:
        function = self.function.__name__
        function_type = 'function'
    if isinstance(self._output_shape, python_types.LambdaType):
        if py3:
            output_shape = marshal.dumps(self._output_shape.__code__)
        else:
            output_shape = marshal.dumps(self._output_shape.func_code)
        output_shape_type = 'lambda'
    elif callable(self._output_shape):
        output_shape = self._output_shape.__name__
        output_shape_type = 'function'
    else:
        output_shape = self._output_shape
        output_shape_type = 'raw'
    config = {
        'function': function,
        'function_type': function_type,
        'output_shape': output_shape,
        'output_shape_type': output_shape_type,
        'arguments': self.arguments,
    }
    base_config = super(Lambda, self).get_config()
    return dict((list(base_config.items()) + list(config.items())))

dataset/ETHPy150Open fchollet/keras/keras/layers/core.py Lambda.get_config/original