question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lambda layers in the keras model

See original GitHub issue

Continued test from issue #41, it seems like the exported keras model has lambda op. Is it correct?

output of print (k_model.summary()) in #41

Layer (type)                 Output Shape              Param #   
=================================================================
input0 (InputLayer)          (None, 3, 224, 224)       0         
_________________________________________________________________
lambda_1 (Lambda)            (None, 3, 232, 232)       0         <-- lambda layer
_________________________________________________________________
conv1.conv2d0.19608361958321 (None, 32, 224, 224)      7808      
_________________________________________________________________
in10.5890283736035935 (Lambd (None, 32, 224, 224)      0         <-- lambda layer
_________________________________________________________________
relu0.8399978862622054 (Acti (None, 32, 224, 224)      0         
=================================================================
Total params: 7,808
Trainable params: 7,808
Non-trainable params: 0

Trying to make the generated keras model file to tfjs (which does not support lambda layer). Knowing that lambda can be any python codes. This would make it not portable to non-python frameworks, such as c++ or js based ones.

Don’t know if it’s logical to ask, but is it possible to workaround this requirements for lambda layer?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gmalivenkocommented, Dec 9, 2018

I afraid it’s tensorflow issue: MirrorPad.

0reactions
gnsmrkycommented, Dec 10, 2018

@nerox8664 Thanks for the finding. I guess the file format does not reflect what’s at the top level. Should’ve realized that earlier.

Next logical step, I guess, is to see what can be tweaked at the graph to avoid MirrorPad.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working With The Lambda Layer in Keras | Paperspace Blog
In this tutorial we'll cover how to use the Lambda layer in Keras to build, save, and load models which perform custom operations...
Read more >
Lambda Layers in tf.keras - Medium
Lambda layer is an easy way to customize a layer to do simple arithmetic. Let say you want to add your own activation...
Read more >
Keras - Lambda Layers - Tutorialspoint
Keras - Lambda Layers, Lambda is used to transform the input data using an expression or function. For example, if Lambda with expression...
Read more >
Lambda layers for custom models - Towards Data Science
The Lambda layer exists so that arbitrary expressions can be used as a Layer when constructing Sequential and Functional API models. Lambda ...
Read more >
How to Use Lambda Layer in a Neural Network?
the lambda layer is a layer for neural network that helps in the data transformation between the other layers of a neural network....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found