【发布时间】:2017-10-07 11:39:45
【问题描述】:
在模型定义中,我使用kernel_regularizer=tf.contrib.layers.l2_regularizer(scale=0.00001)到tf.layers.conv2d()中来正则化每个卷积层中的卷积核。
我的问题是:要计算一些批输入的整个网络的总损失,我们是否需要手动添加正则化损失如下:
reg_losses = tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES)
reg_constant = 0.01 # Choose an appropriate one.
loss = my_normal_loss + reg_constant * sum(reg_losses)
如果是,如何确定上面的reg_constant? scale和reg_constant是什么关系?谢谢。
【问题讨论】:
标签: tensorflow