提交 efdebd70 编写于 作者: W wuchenghui

add dsp_mode parameter

上级 e3f704c4
...@@ -32,7 +32,7 @@ def main(unused_args): ...@@ -32,7 +32,7 @@ def main(unused_args):
if FLAGS.runtime == 'dsp': if FLAGS.runtime == 'dsp':
output_graph_def = tf_dsp_converter_lib.convert_to_mace_pb( output_graph_def = tf_dsp_converter_lib.convert_to_mace_pb(
input_graph_def, FLAGS.input_node, FLAGS.output_node) input_graph_def, FLAGS.input_node, FLAGS.output_node, FLAGS.dsp_mode)
else: else:
output_graph_def = tf_converter_lib.convert_to_mace_pb( output_graph_def = tf_converter_lib.convert_to_mace_pb(
input_graph_def, FLAGS.input_node, FLAGS.output_node, FLAGS.data_type, FLAGS.runtime, FLAGS.winograd) input_graph_def, FLAGS.input_node, FLAGS.output_node, FLAGS.data_type, FLAGS.runtime, FLAGS.winograd)
...@@ -119,6 +119,11 @@ def parse_args(): ...@@ -119,6 +119,11 @@ def parse_args():
const=False, const=False,
default=False, default=False,
help="open winograd convolution or not") help="open winograd convolution or not")
parser.add_argument(
"--dsp_mode",
type=int,
default=0,
help="dsp run mode, defalut=0")
return parser.parse_known_args() return parser.parse_known_args()
......
...@@ -359,7 +359,7 @@ def fuse_quantize(net_def, input_node, output_node): ...@@ -359,7 +359,7 @@ def fuse_quantize(net_def, input_node, output_node):
new_net_def.op.extend(new_ops) new_net_def.op.extend(new_ops)
return new_net_def return new_net_def
def convert_to_mace_pb(input_graph_def, input_node, output_node): def convert_to_mace_pb(input_graph_def, input_node, output_node, dsp_mode):
""" """
nnlib does not have batch norm, so use tensorflow optimizer to fold nnlib does not have batch norm, so use tensorflow optimizer to fold
batch norm with convolution. The fold optimization reorders ops, so batch norm with convolution. The fold optimization reorders ops, so
...@@ -394,5 +394,9 @@ def convert_to_mace_pb(input_graph_def, input_node, output_node): ...@@ -394,5 +394,9 @@ def convert_to_mace_pb(input_graph_def, input_node, output_node):
dtype = mace_pb2.DT_FLOAT dtype = mace_pb2.DT_FLOAT
final_net_def = add_input_output_info(net_def_with_node_id, input_node, output_node, graph, dtype) final_net_def = add_input_output_info(net_def_with_node_id, input_node, output_node, graph, dtype)
arg = final_net_def.arg.add()
arg.name = 'dsp_mode'
arg.i = dsp_mode
return final_net_def return final_net_def
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册