Skip to content

Commit

Permalink
sum -> add
Browse files Browse the repository at this point in the history
  • Loading branch information
fchollet committed Feb 28, 2017
1 parent 8d34c7e commit fbe7873
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/babi_rnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def vectorize_stories(data, word_idx, story_maxlen, query_maxlen):
encoded_question = RNN(EMBED_HIDDEN_SIZE)(encoded_question)
encoded_question = layers.RepeatVector(story_maxlen)(encoded_question)

merged = layers.sum([encoded_sentence, encoded_question])
merged = layers.add([encoded_sentence, encoded_question])
merged = RNN(EMBED_HIDDEN_SIZE)(merged)
merged = layers.Dropout(0.3)(merged)
preds = layers.Dense(vocab_size, activation='softmax')(merged)
Expand Down
4 changes: 2 additions & 2 deletions keras/applications/resnet50.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def identity_block(input_tensor, kernel_size, filters, stage, block):
x = Conv2D(filters3, (1, 1), name=conv_name_base + '2c')(x)
x = BatchNormalization(axis=bn_axis, name=bn_name_base + '2c')(x)

x = layers.sum([x, input_tensor])
x = layers.add([x, input_tensor])
x = Activation('relu')(x)
return x

Expand Down Expand Up @@ -117,7 +117,7 @@ def conv_block(input_tensor, kernel_size, filters, stage, block, strides=(2, 2))
name=conv_name_base + '1')(input_tensor)
shortcut = BatchNormalization(axis=bn_axis, name=bn_name_base + '1')(shortcut)

x = layers.sum([x, shortcut])
x = layers.add([x, shortcut])
x = Activation('relu')(x)
return x

Expand Down
10 changes: 5 additions & 5 deletions keras/applications/xception.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def Xception(include_top=True, weights='imagenet',
x = BatchNormalization(name='block2_sepconv2_bn')(x)

x = MaxPooling2D((3, 3), strides=(2, 2), padding='same', name='block2_pool')(x)
x = layers.sum([x, residual])
x = layers.add([x, residual])

residual = Conv2D(256, (1, 1), strides=(2, 2),
padding='same', use_bias=False)(x)
Expand All @@ -170,7 +170,7 @@ def Xception(include_top=True, weights='imagenet',
x = BatchNormalization(name='block3_sepconv2_bn')(x)

x = MaxPooling2D((3, 3), strides=(2, 2), padding='same', name='block3_pool')(x)
x = layers.sum([x, residual])
x = layers.add([x, residual])

residual = Conv2D(728, (1, 1), strides=(2, 2),
padding='same', use_bias=False)(x)
Expand All @@ -184,7 +184,7 @@ def Xception(include_top=True, weights='imagenet',
x = BatchNormalization(name='block4_sepconv2_bn')(x)

x = MaxPooling2D((3, 3), strides=(2, 2), padding='same', name='block4_pool')(x)
x = layers.sum([x, residual])
x = layers.add([x, residual])

for i in range(8):
residual = x
Expand All @@ -200,7 +200,7 @@ def Xception(include_top=True, weights='imagenet',
x = SeparableConv2D(728, (3, 3), padding='same', use_bias=False, name=prefix + '_sepconv3')(x)
x = BatchNormalization(name=prefix + '_sepconv3_bn')(x)

x = layers.sum([x, residual])
x = layers.add([x, residual])

residual = Conv2D(1024, (1, 1), strides=(2, 2),
padding='same', use_bias=False)(x)
Expand All @@ -214,7 +214,7 @@ def Xception(include_top=True, weights='imagenet',
x = BatchNormalization(name='block13_sepconv2_bn')(x)

x = MaxPooling2D((3, 3), strides=(2, 2), padding='same', name='block13_pool')(x)
x = layers.sum([x, residual])
x = layers.add([x, residual])

x = SeparableConv2D(1536, (3, 3), padding='same', use_bias=False, name='block14_sepconv1')(x)
x = BatchNormalization(name='block14_sepconv1_bn')(x)
Expand Down
2 changes: 1 addition & 1 deletion tests/keras/engine/test_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def test_recursion():

# test merge
layers.concatenate([j_tf, k_tf], axis=1)
layers.sum([j_tf, k_tf])
layers.add([j_tf, k_tf])

# test tensor input
x = tf.placeholder(shape=(None, 2), dtype=K.floatx())
Expand Down

0 comments on commit fbe7873

Please sign in to comment.