Tuesday, May 9, 2017

"Merge" versus "merge", what is the difference? #3921

https://github.com/fchollet/keras/issues/3921

farizrahman4u commented on Sep 29, 2016  edited
  • Merge is a layer.
  • Merge takes layers as input
  • Merge is usually used with Sequential models

  • merge is a function.
  • merge takes tensors as input.
  • merge is a wrapper around Merge.
  • merge is used in Functional API
Using Merge:
left = Sequential()
left.add(...)
left.add(...)

right = Sequential()
right.ad(...)
right.add(...)

model = Sequential()
model.add(Merge([left, right]))
model.add(...)
using merge:
a = Input((10,))
b = Dense(10)(a)
c = Dense(10)(a)
d = merge([b, c])
model = Model(a, d)
Can you please confirm that the Keras 1.2.2 code
from keras.engine import merge
m = merge([init, x], mode='sum')
is equivalent to this Keras 2.0.2 code:
from keras.layers import add
m = add([init, x])