Hackster
Hackster

Reputation: 157

element-wise divison in Keras

is there any way of implementing an element-wise division in keras. What i'm searching for is some kind of merge-layer that divides two inputs element by element. But i didn't find anything like this in keras. Does anyone know a way to do this?

Upvotes: 4

Views: 5496

Answers (1)

javidcf
javidcf

Reputation: 59701

You can use a Lambda layer:

from keras.layers import Lambda

input1 = ...
input2 = ...
result = Lambda(lambda inputs: inputs[0] / inputs[1])([input1, input2])

Upvotes: 7

Related Questions