I'm keeping getting this warning:
lstm.py:119: UserWarning: The
merge
function is deprecated and will be removed after 08/2017. Use instead layers fromkeras.layers.merge
, e.g.add
,concatenate
, etc. merged_vector = merge([l1, l2], mode=lambda x: (x[0] - x[1])**2, output_shape=lambda x: x[0]) /Library/Python/2.7/site-packages/keras/legacy/layers.py:456: UserWarning: TheMerge
layer is deprecated and will be removed after 08/2017. Use instead layers fromkeras.layers.merge
, e.g.add
,concatenate
, etc. name=name)
Which is related to the following line of code:
merged_vector = merge([l1, l2], mode=lambda x: (x[0] - x[1])**2, output_shape=lambda x: x[0])
My model works fine, but how do I implement a custom merge in Keras 2.0.2
? Thank you.
Answering my own question:
# Custom Merge
def euclid_dist(v):
return (v[0] - v[1])**2
def out_shape(shapes):
return shapes[0]
merged_vector = Lambda(euclid_dist, output_shape=out_shape)([l1, l2])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With