提交 e52070e8 编写于 作者: 郭叶军's avatar 郭叶军 提交者: Pedro Arthur

convert_from_tensorflow.py: add support when kernel size is 1*1 with one...

convert_from_tensorflow.py: add support when kernel size is 1*1 with one input/output channel (gray image)
Signed-off-by: 郭叶军's avatarGuo, Yejun <yejun.guo@intel.com>
Signed-off-by: NPedro Arthur <bygrandao@gmail.com>
上级 ed9fc2e3
......@@ -193,7 +193,10 @@ class TFConverter:
filter_width = ktensor.tensor_shape.dim[1].size
in_channels = ktensor.tensor_shape.dim[2].size
out_channels = ktensor.tensor_shape.dim[3].size
kernel = np.frombuffer(ktensor.tensor_content, dtype=np.float32)
if filter_height * filter_width * in_channels * out_channels == 1:
kernel = np.float32(ktensor.float_val[0])
else:
kernel = np.frombuffer(ktensor.tensor_content, dtype=np.float32)
kernel = kernel.reshape(filter_height, filter_width, in_channels, out_channels)
kernel = np.transpose(kernel, [3, 0, 1, 2])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册