Keras: Lambda layer function with multiple parameters

I'm trying to write a layer Lambda

in Keras, which calls a function connection

that starts the cycle for i in range(0,k)

which k

is supplied as an input to a function connection(x,k)

. Now when I try to call a function in the functional API I tried to use:

k = 5
y = Lambda(connection)(x)

      

Besides,

y = Lambda(connection)(x,k)

      

But none of these approaches worked. How can I pass a value k

without assigning it as a global parameter?

+3


source to share


1 answer


Found a solution to the problem in this GitHub Pull request . Using

y = Lambda(connection, arguments={'k':k})(x)

      



works!

+5


source







All Articles