提交 e8c605b8 编写于 作者: 李寅

Merge branch 'duplicate-layer-check' into 'master'

Add duplicate layer check for caffe converter.

See merge request !885
......@@ -324,12 +324,17 @@ class CaffeConverter(base_converter.ConverterInterface):
global_pooling_arg.i = 1
def convert_ops(self):
layer_names = set()
for layer in self._caffe_layers.layer:
caffe_op = self._caffe_net.get_op(layer.name)
if caffe_op not in self._skip_ops:
mace_check(layer.name not in layer_names,
"There is duplicate layer name '%s' in your model"
% layer.name)
mace_check(layer.type in self._op_converters,
"Mace does not support caffe op type %s yet"
% layer.type)
layer_names.add(layer.name)
self._op_converters[layer.type](caffe_op)
def add_tensor(self, name, shape, data_type, value):
......
......@@ -81,7 +81,8 @@ class ShapeInference(object):
def infer_shape_general(self, op):
if len(op.input) > 0:
mace_check(op.input[0] in self._output_shape_cache,
"%s does not exist" % op.input[0])
"Op %s input %s does not exist"
% (op.name, op.input[0]))
input_shape = self._output_shape_cache[op.input[0]]
self.add_output_shape(op, [input_shape])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册