Far*_*naz 5 deep-learning keras tensorflow
我想在 keras 中为完全卷积网络的内层添加跳过连接,有一个 keras.layers.Add 选项,还有一个 keras.layers.concatenate 选项。
有什么不同?我应该使用哪一种?
Viv*_*hta 14
有什么不同?
添加层添加两个输入张量,而 concatenate 附加两个张量。您可以参考此文档以获取更多信息。
例子:
import keras
import tensorflow as tf
import keras.backend as K
a = tf.constant([1,2,3])
b = tf.constant([4,5,6])
add = keras.layers.Add()
print(K.eval(add([a,b])))
#output: [5 7 9]
concat = keras.layers.Concatenate()
print(K.eval(concat([a,b])))
#output: array([1, 2, 3, 4, 5, 6], dtype=int32)
Run Code Online (Sandbox Code Playgroud)
我应该使用哪一种?
您可以使用 Add 跳过连接。
| 归档时间: |
|
| 查看次数: |
2831 次 |
| 最近记录: |