提交 aabcf3d8 编写于 作者: O oneTaken 提交者: Liangliang He

add friendly check for batch normalization layer to better show what's wrong (#199)

* add friendly check for batch normalization layer

* coding style

* reduce the too long line length
上级 34797c2b
......@@ -39,6 +39,7 @@ tf_dilations_str = 'dilations'
tf_data_format_str = 'data_format'
tf_kernel_str = 'ksize'
tf_epsilon_str = 'epsilon'
tf_is_training_str = 'is_training'
tf_align_corners = 'align_corners'
tf_block_size = 'block_size'
tf_squeeze_dims = 'squeeze_dims'
......@@ -516,6 +517,10 @@ class TensorflowConverter(base_converter.ConverterInterface):
op = self.convert_general_op(tf_op)
op.type = MaceOp.FoldedBatchNorm.name
is_training = tf_op.get_attr(tf_is_training_str)
assert is_training is False, 'Only support batch normalization ' \
'with is_training False, but got %s' % is_training
gamma_value = tf_op.inputs[1].eval().astype(np.float32)
beta_value = tf_op.inputs[2].eval().astype(np.float32)
mean_value = tf_op.inputs[3].eval().astype(np.float32)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册