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?
Just use
y = Lambda(connection)((x,k))
and then var[0], var[1] in connection method