Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keras: Lambda layer function with multiple parameters

I am trying to write a Lambda layer in Keras which calls a function connection, that runs a loop for i in range(0,k) where k is fed in as an input to the function, connection(x,k). Now, when I try to call the function in the Functional API, I tried using:

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

Also,

y = Lambda(connection)(x,k)

But neither of those approaches worked. How can I feed in the value of k without assigning it as a global parameter?

like image 812
Prabaha Avatar asked Jul 05 '17 16:07

Prabaha


1 Answers

Just use

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

and then var[0], var[1] in connection method

like image 161
Andrey Nikishaev Avatar answered Oct 14 '22 03:10

Andrey Nikishaev