Reputation: 1375
I want implement merge([a, b], mode='sum')
in tensorflow. What is difference between mode='sum'
and mode='concat'
in keras?
and how can implement merge([a, b], mode='sum')
in tensorlfow?
Upvotes: 2
Views: 1541
Reputation: 12175
Say you have two tensors like [1, 2] and [2, 3]. If you use mode = 'concat' it will concatenate them and give [1, 2, 3, 4]. If you use mode = 'sum' it will add them element wise and give a result [1 + 2, 3 + 2] = [3, 5]. Sum can be implemented using the + operator in tensorflow or the tf.add function. The concat can be used in tensorflow using the tf.concat function.
Upvotes: 2