支持我有一个具有 5 个卷积的网络。我是用 Keras 写的。
x = Input(shape=(None, None, 3))
y = Conv2D(10, 3, strides=1)(x)
y = Conv2D(16, 3, strides=1)(y)
y = Conv2D(32, 3, strides=1)(y)
y = Conv2D(48, 3, strides=1)(y)
y = Conv2D(64, 3, strides=1)(y)
我想将所有卷积设置kernel_initializer为 xavier。方法之一是:
x = Input(shape=(None, None, 3))
y = Conv2D(10, 3, strides=1, kernel_initializer=tf.glorot_uniform_initializer())(x)
y = Conv2D(16, 3, strides=1, kernel_initializer=tf.glorot_uniform_initializer())(y)
y = Conv2D(32, 3, strides=1, kernel_initializer=tf.glorot_uniform_initializer())(y)
y = Conv2D(48, 3, strides=1, kernel_initializer=tf.glorot_uniform_initializer())(y)
y = Conv2D(64, 3, strides=1, kernel_initializer=tf.glorot_uniform_initializer())(y)
但是这种写法很伤感,代码也很冗余。
有没有更好的写作方式?
精慕HU
慕雪6442864
相关分类