[Python Tools] Fix several problems in cross-check-tool (#2170)

This commit is contained in:
Anastasia Kuporosova 2020-09-14 13:49:01 +03:00 committed by GitHub
parent 75601e62ed
commit f7ee106b21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 8 deletions

View File

@ -83,7 +83,7 @@ def get_net_copy_with_output(model: str, output: str, core: IECore):
@error_handling('getting model layers info')
def get_model_info(net: IENetwork):
func = ng.function_from_cnn(net)
ops = func.get_ops()
ops = func.get_ordered_ops()
return ops, net.input_info, net.outputs
@ -164,7 +164,8 @@ def one_ir_mode(args):
if out_layer not in results:
continue
out_blob, pc = results[out_layer]
ref_results = infer(net=net_copy, core=ref_core, device=args.reference_device, inputs=inputs, output=[out_layer])
ref_results = infer(net=net_copy, core=ref_core, device=args.reference_device,
inputs=inputs, output=[out_layer])
if out_layer not in ref_results:
continue
ref_out_blob, ref_pc = ref_results[out_layer]

View File

@ -506,16 +506,23 @@ def manage_user_outputs_with_mapping(mapping, reference_mapping, user_layers):
def get_layers_list(all_layers: list, inputs: dict, outputs: list, layers: str):
if layers is not None and layers != 'None':
if layers == 'all':
return {layer.get_friendly_name(): layer for layer in all_layers if layer.get_type_name() not in ['Const']}
return {layer.get_friendly_name(): layer for layer in all_layers \
if layer.get_type_name() not in ['Constant', 'Result']}
else:
all_layers_names = {op.get_friendly_name() : op for op in all_layers}
user_layers = [layer.strip() for layer in layers.split(',')]
layers_to_check = []
for user_layer in user_layers:
if user_layer not in all_layers:
if user_layer not in all_layers_names:
raise Exception("Layer {} doesn't exist in the model".format(user_layer))
if user_layer in inputs:
raise Exception("Layer {} is input layer. Can not proceed".format(user_layer))
if all_layers_names[user_layer].get_type_name() != 'Result':
layers_to_check.append(user_layer)
else:
# if layer type is Result - add previous layer
prev_layer = all_layers[len(all_layers)-2]
layers_to_check.append(prev_layer.get_friendly_name())
return layers_to_check
else:
return outputs