Python 在Tensorflow 2.0中重写tf.contrib.layers.batch_norm
有人能帮我重写Tf2.0中的以下代码块吗?Python 在Tensorflow 2.0中重写tf.contrib.layers.batch_norm,python,tensorflow,batch-normalization,Python,Tensorflow,Batch Normalization,有人能帮我重写Tf2.0中的以下代码块吗? 我知道batch_norm相当于keras.layers.BatchNormalization,但文档中没有给出“decay”和“epsilon”对应的明确解决方案。谢谢 def batch_norm(opts, _input, is_train, reuse, scope, scale=True): """Batch normalization based on tf.contrib.layers. &
我知道batch_norm相当于keras.layers.BatchNormalization,但文档中没有给出“decay”和“epsilon”对应的明确解决方案。谢谢
def batch_norm(opts, _input, is_train, reuse, scope, scale=True):
"""Batch normalization based on tf.contrib.layers.
"""
return tf.contrib.layers.batch_norm(
_input, center=True, scale=scale,
epsilon=opts['batch_norm_eps'], decay=opts['batch_norm_decay'],
is_training=is_train, reuse=True, updates_collections=None,
scope=scope, fused=False)
在这种情况下,
衰变
对应于tf.keras.layers的动量
。批标准化
和ε
仍然是ε在这种情况下,衰变
对应于tf.keras.layers的动量
。批标准化
和ε
仍然是epsilon
很抱歉,很快,我该如何处理BatchNormalization中没有出现的rest参数?您能帮助在TF2中重写这段代码吗?谢谢!很抱歉,我是如何处理BatchNormalization中未出现的rest参数的?您是否可以帮助在TF2中重写这段代码?谢谢!