From 229cbce4caa531b9f9695e98b38909dfeed234aa Mon Sep 17 00:00:00 2001 From: Tomer Kaftan Date: Mon, 1 Feb 2021 18:26:30 -0800 Subject: [PATCH] Small update to the documentation of lambda layers. PiperOrigin-RevId: 355070948 Change-Id: I2f32fff3373ca331e00cc56d3a798994910cd31d --- tensorflow/python/keras/layers/core.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tensorflow/python/keras/layers/core.py b/tensorflow/python/keras/layers/core.py index d42a021ec4f..220d0c4a809 100644 --- a/tensorflow/python/keras/layers/core.py +++ b/tensorflow/python/keras/layers/core.py @@ -756,13 +756,15 @@ class RepeatVector(Layer): class Lambda(Layer): """Wraps arbitrary expressions as a `Layer` object. - The `Lambda` layer exists so that arbitrary TensorFlow functions - can be used when constructing `Sequential` and Functional API - models. `Lambda` layers are best suited for simple operations or - quick experimentation. For more advanced use cases, follow + The `Lambda` layer exists so that arbitrary expressions can be used + as a `Layer` when constructing `Sequential` + and Functional API models. `Lambda` layers are best suited for simple + operations or quick experimentation. For more advanced use cases, follow [this guide](https://www.tensorflow.org/guide/keras/custom_layers_and_models) for subclassing `tf.keras.layers.Layer`. + WARNING: `tf.keras.layers.Lambda` layers have (de)serialization limitations! + The main reason to subclass `tf.keras.layers.Layer` instead of using a `Lambda` layer is saving and inspecting a Model. `Lambda` layers are saved by serializing the Python bytecode, which is fundamentally