[Question] When is it absolutely necessary to use a Lambda
layer?
#19791
Labels
stale
stat:awaiting response from contributor
type:support
User is asking for help / asking an implementation question. Stackoverflow would be better suited.
Reading Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow by Aurélien Géron I noticed that to use a preprocess function (like
preprocess_input
) it is necessary to put it inside aLambda
layer if you build aSequential
model otherwise an error is raised.Now, the question is this requirement is required also for
Functional
model?It seems no. Digging into Keras' repos I found three examples:
preprocess_input
withoutLambda
.Lambda
(maybe?) becausepreprocess_input
occurs inside aSequential
model.Furthermore, I discovered that Functional API can also include raw Keras 3 ops.
If possible, I would want to add to my
Functional
modeltf.expand_dims
, but in this case I suppose(?) that I must use aLambda
layer. To be sure I could always use aLambda
layer (or even better a custom one), but I would want to understand when aLambda
layer is strictly necessary.The text was updated successfully, but these errors were encountered: