Browse Source

add stack info into node attr

pull/1333/head
yelihua 4 years ago
parent
commit
384de8a6d0
33 changed files with 78 additions and 370 deletions
  1. +3
    -1
      mindinsight/datavisual/data_transform/graph/msgraph.py
  2. +5
    -2
      mindinsight/datavisual/data_transform/graph/node.py
  3. +0
    -2
      mindinsight/debugger/stream_handler/graph_handler.py
  4. +1
    -1
      tests/st/func/datavisual/graph/graph_results/test_query_nodes_success_result1.json
  5. +1
    -1
      tests/st/func/datavisual/graph/graph_results/test_query_nodes_success_result2.json
  6. +1
    -1
      tests/st/func/datavisual/graph/graph_results/test_query_nodes_success_result3.json
  7. +1
    -1
      tests/st/func/datavisual/graph/graph_results/test_query_single_node_success_result1.json
  8. +1
    -56
      tests/st/func/debugger/expect_results/restful_results/compare_tensors.json
  9. +1
    -1
      tests/st/func/debugger/expect_results/restful_results/multi_next_node.json
  10. +1
    -1
      tests/st/func/debugger/expect_results/restful_results/multi_retrieve_aggregation_scope_node.json
  11. +1
    -1
      tests/st/func/debugger/expect_results/restful_results/multi_retrieve_all.json
  12. +1
    -1
      tests/st/func/debugger/expect_results/restful_results/multi_retrieve_scope_node.json
  13. +1
    -1
      tests/st/func/debugger/expect_results/restful_results/multi_retrieve_single_node.json
  14. +1
    -1
      tests/st/func/debugger/expect_results/restful_results/retrieve_aggregation_scope_node.json
  15. +1
    -1
      tests/st/func/debugger/expect_results/restful_results/retrieve_all.json
  16. +1
    -21
      tests/st/func/debugger/expect_results/restful_results/retrieve_empty_tensor_history.json
  17. +1
    -37
      tests/st/func/debugger/expect_results/restful_results/retrieve_full_tensor_history.json
  18. +1
    -1
      tests/st/func/debugger/expect_results/restful_results/retrieve_next_node_on_gpu.json
  19. +1
    -1
      tests/st/func/debugger/expect_results/restful_results/retrieve_scope_node.json
  20. +1
    -1
      tests/st/func/debugger/expect_results/restful_results/retrieve_single_node.json
  21. +1
    -118
      tests/st/func/debugger/expect_results/restful_results/retrieve_tensor_graph-1.json
  22. +1
    -104
      tests/st/func/debugger/expect_results/restful_results/search_activation_multi_graph.json
  23. +39
    -2
      tests/st/func/debugger/test_restful_api.py
  24. +3
    -3
      tests/st/func/debugger/utils.py
  25. +1
    -1
      tests/ut/datavisual/processors/graph_results/test_get_nodes_success_expected_results1.json
  26. +1
    -1
      tests/ut/datavisual/processors/graph_results/test_get_nodes_success_expected_results2.json
  27. +1
    -1
      tests/ut/datavisual/processors/graph_results/test_get_nodes_success_expected_results3.json
  28. +1
    -1
      tests/ut/datavisual/processors/graph_results/test_get_nodes_success_expected_results4.json
  29. +1
    -1
      tests/ut/datavisual/processors/graph_results/test_search_single_node_success_expected_results1.json
  30. +1
    -2
      tests/ut/datavisual/processors/test_graph_processor.py
  31. +1
    -1
      tests/ut/debugger/expected_results/graph/graph_handler_get_1_no_filter_condintion.json
  32. +1
    -1
      tests/ut/debugger/expected_results/graph/graph_handler_get_2_list_nodes.json
  33. +1
    -1
      tests/ut/debugger/expected_results/graph/graph_handler_get_3_single_node.json

+ 3
- 1
mindinsight/datavisual/data_transform/graph/msgraph.py View File

@@ -16,6 +16,7 @@
from mindinsight.datavisual.common.log import logger
from mindinsight.datavisual.proto_files.mindinsight_anf_ir_pb2 import DataType
from mindinsight.datavisual.common.enums import PluginNameEnum
from mindinsight.domain.graph.base import Source
from .node_tree import NodeTree
from .node import Node
from .node import NodeTypeEnum
@@ -77,7 +78,8 @@ class MSGraph(Graph):
node = Node(name=node_name, node_id=node_proto.name, topological_index=topological_index)
node.full_name = node_proto.full_name
node.type = node_proto.op_type

if getattr(node_proto, 'source_address', None):
node.stack = Source.build_stack_from_source_address(node_proto.source_address)
self._parse_attributes(node_proto.attribute, node)
self._parse_inputs(node_proto.input, node)



+ 5
- 2
mindinsight/datavisual/data_transform/graph/node.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -55,6 +55,7 @@ class Node:
self.full_name = ""
# This value will be used as the priority field.
self.topological_index = topological_index
self.stack = []

def to_dict(self):
"""Converts the node object to dictionary format."""
@@ -68,7 +69,8 @@ class Node:
'proxy_input': self._proxy_input,
'proxy_output': self._proxy_output,
'subnode_count': self.subnode_count,
'independent_layout': self.independent_layout
'independent_layout': self.independent_layout,
'stack_info': [source.to_dict() for source in self.stack]
}

@property
@@ -224,6 +226,7 @@ class Node:
dst_node.output_nums = src_node.output_nums
dst_node.elem_types = src_node.elem_types
dst_node.add_attr(src_node.attr)
dst_node.stack = src_node.stack

def __str__(self):
return f'<Node, name: {self.name}, type: {self.type}>'

+ 0
- 2
mindinsight/debugger/stream_handler/graph_handler.py View File

@@ -72,7 +72,6 @@ class MultiCardGraphHandler:
self.__init__()



class GraphHandler(StreamHandlerBase):
"""Metadata Handler."""

@@ -88,7 +87,6 @@ class GraphHandler(StreamHandlerBase):
self.graph_node_map = {}
# dict of <node ui name, Node object> for all graphs
self._all_leaf_nodes = {}

# the whole graph
self._whole_graph = None



+ 1
- 1
tests/st/func/datavisual/graph/graph_results/test_query_nodes_success_result1.json View File

@@ -1 +1 @@
{"nodes":[{"attr":{},"independent_layout":false,"input":{},"name":"Default","output":{},"output_i":0,"proxy_input":{},"proxy_output":{},"subnode_count":3,"type":"name_scope"}]}
{"nodes": [{"name": "Default", "type": "name_scope", "attr": {}, "input": {}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 3, "independent_layout": false, "stack_info": []}]}

+ 1
- 1
tests/st/func/datavisual/graph/graph_results/test_query_nodes_success_result2.json View File

@@ -1 +1 @@
{"nodes": [{"name": "Default/conv1-Conv2d", "type": "name_scope", "attr": {}, "input": {}, "output": {"Default/bn1/Reshape[12]_1/Reshape6": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 2, "independent_layout": false}, {"name": "Default/bn1-BatchNorm2d", "type": "name_scope", "attr": {}, "input": {}, "output": {"Default/bn1/Add[5]_0/Add53": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 5, "independent_layout": false}, {"name": "Default/bn1", "type": "name_scope", "attr": {}, "input": {"Default/bn1-BatchNorm2d/tuple_getitem56": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Conv2D55": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 4, "independent_layout": false}]}
{"nodes": [{"name": "Default/conv1-Conv2d", "type": "name_scope", "attr": {}, "input": {}, "output": {"Default/bn1/Reshape[12]_1/Reshape6": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 2, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1-BatchNorm2d", "type": "name_scope", "attr": {}, "input": {}, "output": {"Default/bn1/Add[5]_0/Add53": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 5, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1", "type": "name_scope", "attr": {}, "input": {"Default/bn1-BatchNorm2d/tuple_getitem56": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Conv2D55": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 4, "independent_layout": false, "stack_info": []}]}

+ 1
- 1
tests/st/func/datavisual/graph/graph_results/test_query_nodes_success_result3.json View File

@@ -1 +1 @@
{"nodes": [{"name": "Default/bn1/Reshape[12]_1/Reshape1", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add50": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape2", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add51": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape3", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add52": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape4", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add53": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape5", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add54": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape6", "type": "Reshape", "attr": {}, "input": {"Default/conv1-Conv2d/Conv2D55": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape7", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape8", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape9", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape10", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape11", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape12", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}]}
{"nodes": [{"name": "Default/bn1/Reshape[12]_1/Reshape1", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add50": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape2", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add51": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape3", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add52": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape4", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add53": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape5", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add54": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape6", "type": "Reshape", "attr": {}, "input": {"Default/conv1-Conv2d/Conv2D55": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape7", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape8", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape9", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape10", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape11", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape12", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}]}

+ 1
- 1
tests/st/func/datavisual/graph/graph_results/test_query_single_node_success_result1.json View File

@@ -1 +1 @@
{"nodes": [{"name": "Default", "type": "name_scope", "attr": {}, "input": {}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 3, "independent_layout": false}], "scope_name": "", "children": {"nodes": [{"name": "Default/conv1-Conv2d", "type": "name_scope", "attr": {}, "input": {}, "output": {"Default/bn1/Reshape[12]_1/Reshape6": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 2, "independent_layout": false}, {"name": "Default/bn1-BatchNorm2d", "type": "name_scope", "attr": {}, "input": {}, "output": {"Default/bn1/Add[5]_0/Add53": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 5, "independent_layout": false}, {"name": "Default/bn1", "type": "name_scope", "attr": {}, "input": {"Default/bn1-BatchNorm2d/tuple_getitem56": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Conv2D55": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 4, "independent_layout": false}], "scope_name": "Default", "children": {}}}
{"nodes": [{"name": "Default", "type": "name_scope", "attr": {}, "input": {}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 3, "independent_layout": false, "stack_info": []}], "scope_name": "", "children": {"nodes": [{"name": "Default/conv1-Conv2d", "type": "name_scope", "attr": {}, "input": {}, "output": {"Default/bn1/Reshape[12]_1/Reshape6": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 2, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1-BatchNorm2d", "type": "name_scope", "attr": {}, "input": {}, "output": {"Default/bn1/Add[5]_0/Add53": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 5, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1", "type": "name_scope", "attr": {}, "input": {"Default/bn1-BatchNorm2d/tuple_getitem56": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Conv2D55": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 4, "independent_layout": false, "stack_info": []}], "scope_name": "Default", "children": {}}}

+ 1
- 56
tests/st/func/debugger/expect_results/restful_results/compare_tensors.json View File

@@ -1,56 +1 @@
{
"tensor_value": {
"full_name": "Default/args0:0",
"step": 3,
"dtype": "DT_FLOAT32",
"shape": [2, 3],
"diff": [
[
[1.0, 1.0, 0.0],
[2.0, 2.0, 0.0],
[3.0, 3.0, 0.0]
],
[
[4.0, 4.0, 0.0],
[5.0, 5.0, 0.0],
[6.0, 6.0, 0.0]
]
],
"curr_step_statistics": {
"overall_max": 6.0,
"overall_min": 1.0,
"overall_avg": 3.5,
"overall_count": 6,
"overall_nan_count": 0,
"overall_neg_inf_count": 0,
"overall_pos_inf_count": 0,
"overall_zero_count": 0.0,
"overall_neg_zero_count": 0.0,
"overall_pos_zero_count": 6.0
},
"prev_step_statistics": {
"overall_max": 6.0,
"overall_min": 1.0,
"overall_avg": 3.5,
"overall_count": 6,
"overall_nan_count": 0,
"overall_neg_inf_count": 0,
"overall_pos_inf_count": 0,
"overall_zero_count": 0.0,
"overall_neg_zero_count": 0.0,
"overall_pos_zero_count": 6.0
},
"statistics": {
"overall_max": 0.0,
"overall_min": 0.0,
"overall_avg": 0.0,
"overall_count": 6,
"overall_nan_count": 0,
"overall_neg_inf_count": 0,
"overall_pos_inf_count": 0,
"overall_zero_count": 6.0,
"overall_neg_zero_count": 0.0,
"overall_pos_zero_count": 0.0
}
}
}
{"tensor_value": {"full_name": "Default/args0:0", "step": 3, "dtype": "DT_FLOAT32", "shape": [2, 3], "diff": [[[1.0, 1.0, 0.0], [2.0, 2.0, 0.0], [3.0, 3.0, 0.0]], [[4.0, 4.0, 0.0], [5.0, 5.0, 0.0], [6.0, 6.0, 0.0]]], "curr_step_statistics": {"overall_max": 6.0, "overall_min": 1.0, "overall_avg": 3.5, "overall_count": 6, "overall_nan_count": 0, "overall_neg_inf_count": 0, "overall_pos_inf_count": 0, "overall_zero_count": 0.0, "overall_neg_zero_count": 0.0, "overall_pos_zero_count": 6.0}, "prev_step_statistics": {"overall_max": 6.0, "overall_min": 1.0, "overall_avg": 3.5, "overall_count": 6, "overall_nan_count": 0, "overall_neg_inf_count": 0, "overall_pos_inf_count": 0, "overall_zero_count": 0.0, "overall_neg_zero_count": 0.0, "overall_pos_zero_count": 6.0}, "statistics": {"overall_max": 0.0, "overall_min": 0.0, "overall_avg": 0.0, "overall_count": 6, "overall_nan_count": 0, "overall_neg_inf_count": 0, "overall_pos_inf_count": 0, "overall_zero_count": 6.0, "overall_neg_zero_count": 0.0, "overall_pos_zero_count": 0.0}}}

+ 1
- 1
tests/st/func/debugger/expect_results/restful_results/multi_next_node.json View File

@@ -1 +1 @@
{"metadata": {"state": "waiting", "step": 1, "device_name": "0", "node_name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/OneHot-op0", "backend": "GPU", "enable_recheck": false, "graph_name": "graph_1", "recommendation_confirmed": false, "debugger_version": {}}, "graph": {"graph_names": ["graph_0", "graph_1"], "nodes": [{"name": "graph_0", "type": "name_scope", "attr": {}, "input": {}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 2, "independent_layout": false}, {"name": "graph_1", "type": "name_scope", "attr": {}, "input": {}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 2, "independent_layout": false}]}, "devices": [{"rank_id": 0, "device_id": "0", "graph_names": ["graph_0", "graph_1"]}], "watch_points": []}
{"metadata": {"state": "waiting", "step": 1, "device_name": "0", "node_name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/OneHot-op0", "backend": "GPU", "enable_recheck": false, "graph_name": "graph_1", "recommendation_confirmed": false, "debugger_version": {}}, "graph": {"graph_names": ["graph_0", "graph_1"], "nodes": [{"name": "graph_0", "type": "name_scope", "attr": {}, "input": {}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 2, "independent_layout": false, "stack_info": []}, {"name": "graph_1", "type": "name_scope", "attr": {}, "input": {}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 2, "independent_layout": false, "stack_info": []}]}, "devices": [{"rank_id": 0, "device_id": "0", "graph_names": ["graph_0", "graph_1"]}], "watch_points": []}

+ 1
- 1
tests/st/func/debugger/expect_results/restful_results/multi_retrieve_aggregation_scope_node.json
File diff suppressed because it is too large
View File


+ 1
- 1
tests/st/func/debugger/expect_results/restful_results/multi_retrieve_all.json View File

@@ -1 +1 @@
{"metadata": {"state": "waiting", "step": 1, "device_name": "0", "node_name": "", "backend": "Ascend", "enable_recheck": false, "graph_name": "", "recommendation_confirmed": false, "debugger_version": {}}, "graph": {"graph_names": ["graph_0", "graph_1"], "nodes": [{"name": "graph_0", "type": "name_scope", "attr": {}, "input": {}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 2, "independent_layout": false}, {"name": "graph_1", "type": "name_scope", "attr": {}, "input": {}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 2, "independent_layout": false}]}, "devices": [{"rank_id": 0, "device_id": "0", "graph_names": ["graph_0", "graph_1"]}], "watch_points": []}
{"metadata": {"state": "waiting", "step": 1, "device_name": "0", "node_name": "", "backend": "Ascend", "enable_recheck": false, "graph_name": "", "recommendation_confirmed": false, "debugger_version": {}}, "graph": {"graph_names": ["graph_0", "graph_1"], "nodes": [{"name": "graph_0", "type": "name_scope", "attr": {}, "input": {}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 2, "independent_layout": false, "stack_info": []}, {"name": "graph_1", "type": "name_scope", "attr": {}, "input": {}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 2, "independent_layout": false, "stack_info": []}]}, "devices": [{"rank_id": 0, "device_id": "0", "graph_names": ["graph_0", "graph_1"]}], "watch_points": []}

+ 1
- 1
tests/st/func/debugger/expect_results/restful_results/multi_retrieve_scope_node.json
File diff suppressed because it is too large
View File


+ 1
- 1
tests/st/func/debugger/expect_results/restful_results/multi_retrieve_single_node.json
File diff suppressed because it is too large
View File


+ 1
- 1
tests/st/func/debugger/expect_results/restful_results/retrieve_aggregation_scope_node.json
File diff suppressed because it is too large
View File


+ 1
- 1
tests/st/func/debugger/expect_results/restful_results/retrieve_all.json
File diff suppressed because it is too large
View File


+ 1
- 21
tests/st/func/debugger/expect_results/restful_results/retrieve_empty_tensor_history.json View File

@@ -1,21 +1 @@
{
"tensor_history": [
{
"name": "Default/TransData-op99:0",
"full_name": "Default/TransData-op99:0",
"node_type": "TransData",
"type": "output",
"graph_name": "graph_0"
},
{
"name": "Default/args0:0",
"full_name": "Default/args0:0",
"node_type": "Parameter",
"type": "input",
"graph_name": "graph_0"
}
],
"metadata": {
"step": 1
}
}
{"tensor_history": [{"name": "Default/TransData-op99:0", "full_name": "Default/TransData-op99:0", "node_type": "TransData", "type": "output", "graph_name": "graph_0"}, {"name": "Default/args0:0", "full_name": "Default/args0:0", "node_type": "Parameter", "type": "input", "graph_name": "graph_0"}], "metadata": {"step": 1}}

+ 1
- 37
tests/st/func/debugger/expect_results/restful_results/retrieve_full_tensor_history.json View File

@@ -1,37 +1 @@
{
"tensor_history": [
{
"name": "Default/TransData-op99:0",
"full_name": "Default/TransData-op99:0",
"node_type": "TransData",
"type": "output",
"graph_name": "graph_0",
"step": 1,
"dtype": "DT_FLOAT32",
"shape": [
2,
3
],
"has_prev_step": false,
"value": "click to view"
},
{
"name": "Default/args0:0",
"full_name": "Default/args0:0",
"node_type": "Parameter",
"type": "input",
"graph_name": "graph_0",
"step": 1,
"dtype": "DT_FLOAT32",
"shape": [
2,
3
],
"has_prev_step": true,
"value": "click to view"
}
],
"metadata": {
"step": 1
}
}
{"tensor_history": [{"name": "Default/TransData-op99:0", "full_name": "Default/TransData-op99:0", "node_type": "TransData", "type": "output", "graph_name": "graph_0", "step": 1, "dtype": "DT_FLOAT32", "shape": [2, 3], "has_prev_step": false, "value": "click to view"}, {"name": "Default/args0:0", "full_name": "Default/args0:0", "node_type": "Parameter", "type": "input", "graph_name": "graph_0", "step": 1, "dtype": "DT_FLOAT32", "shape": [2, 3], "has_prev_step": true, "value": "click to view"}], "metadata": {"step": 1}}

+ 1
- 1
tests/st/func/debugger/expect_results/restful_results/retrieve_next_node_on_gpu.json
File diff suppressed because it is too large
View File


+ 1
- 1
tests/st/func/debugger/expect_results/restful_results/retrieve_scope_node.json
File diff suppressed because it is too large
View File


+ 1
- 1
tests/st/func/debugger/expect_results/restful_results/retrieve_single_node.json
File diff suppressed because it is too large
View File


+ 1
- 118
tests/st/func/debugger/expect_results/restful_results/retrieve_tensor_graph-1.json View File

@@ -1,118 +1 @@
{
"graph": {
"nodes": [
{
"name": "Default/optimizer-Momentum/ApplyMomentum[8]_1/ApplyMomentum-op38",
"full_name": "Default/optimizer-Momentum/ApplyMomentum-op38",
"type": "ApplyMomentum",
"input": {
"Default/optimizer-Momentum/Parameter[18]_7/moments.fc1.bias": {
"shape": [
[
120
]
],
"edge_type": "data",
"independent_layout": true,
"data_type": "DT_TENSOR[DT_FLOAT32]",
"slot_mapping": [
[
"0",
""
]
]
}
},
"output": {},
"slots": [
{
"slot": "0",
"statistics": {
"overall_max": 6.0,
"overall_min": 1.0,
"overall_avg": 3.5,
"overall_count": 6,
"overall_nan_count": 0,
"overall_neg_inf_count": 0,
"overall_pos_inf_count": 0,
"overall_zero_count": 0.0,
"overall_neg_zero_count": 0.0,
"overall_pos_zero_count": 6.0
},
"shape": [
2,
3
]
},
{
"slot": "1",
"statistics": {
"overall_max": 6.0,
"overall_min": 1.0,
"overall_avg": 3.5,
"overall_count": 6,
"overall_nan_count": 0,
"overall_neg_inf_count": 0,
"overall_pos_inf_count": 0,
"overall_zero_count": 0.0,
"overall_neg_zero_count": 0.0,
"overall_pos_zero_count": 6.0
},
"shape": [
2,
3
]
}
],
"graph_name": "graph_0"
},
{
"name": "Default/optimizer-Momentum/Parameter[18]_7/moments.fc1.bias",
"full_name": "Default/optimizer-Momentum/Parameter[18]_7/moments.fc1.bias",
"type": "Parameter",
"input": {},
"output": {
"Default/optimizer-Momentum/ApplyMomentum[8]_1/ApplyMomentum-op38": {
"shape": [
[
120
]
],
"edge_type": "data",
"independent_layout": true,
"data_type": "DT_TENSOR[DT_FLOAT32]",
"slot_mapping": [
[
"0",
""
]
]
}
},
"slots": [
{
"slot": "0",
"statistics": {
"overall_max": 6.0,
"overall_min": 1.0,
"overall_avg": 3.5,
"overall_count": 6,
"overall_nan_count": 0,
"overall_neg_inf_count": 0,
"overall_pos_inf_count": 0,
"overall_zero_count": 0.0,
"overall_neg_zero_count": 0.0,
"overall_pos_zero_count": 6.0
},
"shape": [
2,
3
],
"has_prev_step": true
}
],
"graph_name": "graph_0"
}
]
}
}
{"graph": {"nodes": [{"name": "Default/optimizer-Momentum/ApplyMomentum[8]_1/ApplyMomentum-op38", "full_name": "Default/optimizer-Momentum/ApplyMomentum-op38", "type": "ApplyMomentum", "input": {"Default/optimizer-Momentum/Parameter[18]_7/moments.fc1.bias": {"shape": [[120]], "edge_type": "data", "independent_layout": true, "data_type": "DT_TENSOR[DT_FLOAT32]", "slot_mapping": [["0", ""]]}}, "output": {}, "slots": [{"slot": "0", "statistics": {"overall_max": 6.0, "overall_min": 1.0, "overall_avg": 3.5, "overall_count": 6, "overall_nan_count": 0, "overall_neg_inf_count": 0, "overall_pos_inf_count": 0, "overall_zero_count": 0.0, "overall_neg_zero_count": 0.0, "overall_pos_zero_count": 6.0}, "shape": [2, 3]}, {"slot": "1", "statistics": {"overall_max": 6.0, "overall_min": 1.0, "overall_avg": 3.5, "overall_count": 6, "overall_nan_count": 0, "overall_neg_inf_count": 0, "overall_pos_inf_count": 0, "overall_zero_count": 0.0, "overall_neg_zero_count": 0.0, "overall_pos_zero_count": 6.0}, "shape": [2, 3]}], "graph_name": "graph_0"}, {"name": "Default/optimizer-Momentum/Parameter[18]_7/moments.fc1.bias", "full_name": "Default/optimizer-Momentum/Parameter[18]_7/moments.fc1.bias", "type": "Parameter", "input": {}, "output": {"Default/optimizer-Momentum/ApplyMomentum[8]_1/ApplyMomentum-op38": {"shape": [[120]], "edge_type": "data", "independent_layout": true, "data_type": "DT_TENSOR[DT_FLOAT32]", "slot_mapping": [["0", ""]]}}, "slots": [{"slot": "0", "statistics": {"overall_max": 6.0, "overall_min": 1.0, "overall_avg": 3.5, "overall_count": 6, "overall_nan_count": 0, "overall_neg_inf_count": 0, "overall_pos_inf_count": 0, "overall_zero_count": 0.0, "overall_neg_zero_count": 0.0, "overall_pos_zero_count": 6.0}, "shape": [2, 3], "has_prev_step": true}], "graph_name": "graph_0"}]}}

+ 1
- 104
tests/st/func/debugger/expect_results/restful_results/search_activation_multi_graph.json View File

@@ -1,104 +1 @@
{
"nodes": [
{
"name": "graph_0",
"type": "name_scope",
"nodes": [
{
"name": "graph_0/Default",
"type": "name_scope",
"nodes": [
{
"name": "graph_0/Default/network-WithLossCell",
"type": "name_scope",
"nodes": [
{
"name": "graph_0/Default/network-WithLossCell/_backbone-LeNet5",
"type": "name_scope",
"nodes": [
{
"name": "graph_0/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU",
"type": "name_scope",
"nodes": [
{
"name": "graph_0/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLUV2-op87",
"type": "ReLUV2",
"nodes": []
},
{
"name": "graph_0/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLUV2-op89",
"type": "ReLUV2",
"nodes": []
},
{
"name": "graph_0/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLU-op12",
"type": "ReLU",
"nodes": []
},
{
"name": "graph_0/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLU-op15",
"type": "ReLU",
"nodes": []
}
]
}
]
}
]
}
]
}
]
},
{
"name": "graph_1",
"type": "name_scope",
"nodes": [
{
"name": "graph_1/Default",
"type": "name_scope",
"nodes": [
{
"name": "graph_1/Default/network-WithLossCell",
"type": "name_scope",
"nodes": [
{
"name": "graph_1/Default/network-WithLossCell/_backbone-LeNet5",
"type": "name_scope",
"nodes": [
{
"name": "graph_1/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU",
"type": "name_scope",
"nodes": [
{
"name": "graph_1/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLUV2-op87",
"type": "ReLUV2",
"nodes": []
},
{
"name": "graph_1/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLUV2-op89",
"type": "ReLUV2",
"nodes": []
},
{
"name": "graph_1/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLU-op12",
"type": "ReLU",
"nodes": []
},
{
"name": "graph_1/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLU-op15",
"type": "ReLU",
"nodes": []
}
]
}
]
}
]
}
]
}
]
}
]
}
{"nodes": [{"name": "graph_0", "type": "name_scope", "nodes": [{"name": "graph_0/Default", "type": "name_scope", "nodes": [{"name": "graph_0/Default/network-WithLossCell", "type": "name_scope", "nodes": [{"name": "graph_0/Default/network-WithLossCell/_backbone-LeNet5", "type": "name_scope", "nodes": [{"name": "graph_0/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU", "type": "name_scope", "nodes": [{"name": "graph_0/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLUV2-op87", "type": "ReLUV2", "nodes": []}, {"name": "graph_0/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLUV2-op89", "type": "ReLUV2", "nodes": []}, {"name": "graph_0/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLU-op12", "type": "ReLU", "nodes": []}, {"name": "graph_0/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLU-op15", "type": "ReLU", "nodes": []}]}]}]}]}]}, {"name": "graph_1", "type": "name_scope", "nodes": [{"name": "graph_1/Default", "type": "name_scope", "nodes": [{"name": "graph_1/Default/network-WithLossCell", "type": "name_scope", "nodes": [{"name": "graph_1/Default/network-WithLossCell/_backbone-LeNet5", "type": "name_scope", "nodes": [{"name": "graph_1/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU", "type": "name_scope", "nodes": [{"name": "graph_1/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLUV2-op87", "type": "ReLUV2", "nodes": []}, {"name": "graph_1/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLUV2-op89", "type": "ReLUV2", "nodes": []}, {"name": "graph_1/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLU-op12", "type": "ReLU", "nodes": []}, {"name": "graph_1/Default/network-WithLossCell/_backbone-LeNet5/relu-ReLU/ReLU-op15", "type": "ReLU", "nodes": []}]}]}]}]}]}]}

+ 39
- 2
tests/st/func/debugger/test_restful_api.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@ from mindinsight.debugger.common.utils import ServerStatus
from tests.st.func.debugger.conftest import DEBUGGER_BASE_URL
from tests.st.func.debugger.mock_ms_client import MockDebuggerClient
from tests.st.func.debugger.utils import check_state, get_request_result, \
send_and_compare_result
send_and_compare_result, send_and_save_result


def send_terminate_cmd(app_client):
@@ -44,6 +44,7 @@ class TestAscendDebugger:
@classmethod
def setup_class(cls):
"""Setup class."""
cls.save_results = False
cls._debugger_client = MockDebuggerClient(backend='Ascend')

@pytest.mark.level0
@@ -79,6 +80,8 @@ class TestAscendDebugger:
url = 'retrieve'
with self._debugger_client.get_thread_instance():
check_state(app_client)
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file)
send_and_compare_result(app_client, url, body_data, expect_file)
send_terminate_cmd(app_client)

@@ -89,6 +92,8 @@ class TestAscendDebugger:
expect_file = 'get_conditions_for_ascend.json'
with self._debugger_client.get_thread_instance():
check_state(app_client)
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file, method='get', full_url=True)
send_and_compare_result(app_client, url, body_data, expect_file, method='get', full_url=True)
send_terminate_cmd(app_client)

@@ -117,6 +122,8 @@ class TestAscendDebugger:
debugger_client = MockDebuggerClient(backend='Ascend', graph_num=2)
with debugger_client.get_thread_instance():
check_state(app_client)
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file)
send_and_compare_result(app_client, url, body_data, expect_file)
send_terminate_cmd(app_client)

@@ -148,6 +155,8 @@ class TestAscendDebugger:
url = 'retrieve'
body_data = {'mode': 'watchpoint'}
expect_file = 'create_and_delete_watchpoint.json'
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file)
send_and_compare_result(app_client, url, body_data, expect_file)
send_terminate_cmd(app_client)

@@ -175,6 +184,8 @@ class TestAscendDebugger:
url = 'search'
body_data = {'name': leaf_node_name, 'watch_point_id': watch_point_id}
expect_file = 'search_unwatched_leaf_node.json'
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file, method='get')
send_and_compare_result(app_client, url, body_data, expect_file, method='get')
send_terminate_cmd(app_client)

@@ -193,12 +204,16 @@ class TestAscendDebugger:
url = 'tensor-history'
body_data = {'name': node_name, 'rank_id': 0}
expect_file = 'retrieve_empty_tensor_history.json'
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file)
send_and_compare_result(app_client, url, body_data, expect_file)
# check full tensor history from poll data
res = get_request_result(
app_client=app_client, url='poll-data', body_data={'pos': 0}, method='get')
assert res.get('receive_tensor', {}).get('node_name') == node_name
expect_file = 'retrieve_full_tensor_history.json'
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file)
send_and_compare_result(app_client, url, body_data, expect_file)
# check tensor value
url = 'tensors'
@@ -208,6 +223,8 @@ class TestAscendDebugger:
'shape': quote('[1, 1:3]')
}
expect_file = 'retrieve_tensor_value.json'
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file, method='get')
send_and_compare_result(app_client, url, body_data, expect_file, method='get')
send_terminate_cmd(app_client)

@@ -242,6 +259,8 @@ class TestAscendDebugger:
'tolerance': 1,
'rank_id': 0}
expect_file = 'compare_tensors.json'
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file, method='get')
send_and_compare_result(app_client, url, body_data, expect_file, method='get')
send_terminate_cmd(app_client)

@@ -339,6 +358,8 @@ class TestAscendDebugger:
res = get_request_result(
app_client=app_client, url='poll-data', body_data={'pos': 0}, method='get')
assert res.get('receive_tensor', {}).get('tensor_name') == body_data.get('tensor_name')
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file, method='GET')
send_and_compare_result(app_client, url, body_data, expect_file, method='GET')
send_terminate_cmd(app_client)

@@ -349,6 +370,7 @@ class TestGPUDebugger:
@classmethod
def setup_class(cls):
"""Setup class."""
cls.save_results = False
cls._debugger_client = MockDebuggerClient(backend='GPU')

@pytest.mark.level0
@@ -360,6 +382,7 @@ class TestGPUDebugger:
def test_next_node_on_gpu(self, app_client):
"""Test get next node on GPU."""
gpu_debugger_client = MockDebuggerClient(backend='GPU')
check_state(app_client, 'pending')
with gpu_debugger_client.get_thread_instance():
check_state(app_client)
# send run command to get watchpoint hit
@@ -374,6 +397,8 @@ class TestGPUDebugger:
url = 'retrieve'
body_data = {'mode': 'all'}
expect_file = 'retrieve_next_node_on_gpu.json'
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file)
send_and_compare_result(app_client, url, body_data, expect_file)
send_terminate_cmd(app_client)

@@ -428,6 +453,8 @@ class TestGPUDebugger:
expect_file = 'get_conditions_for_gpu.json'
with self._debugger_client.get_thread_instance():
check_state(app_client)
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file, method='get', full_url=True)
send_and_compare_result(app_client, url, body_data, expect_file, method='get', full_url=True)
send_terminate_cmd(app_client)

@@ -476,6 +503,7 @@ class TestMultiGraphDebugger:
@classmethod
def setup_class(cls):
"""Setup class."""
cls.save_results = False
cls._debugger_client = MockDebuggerClient(backend='Ascend', graph_num=2)

@pytest.mark.level0
@@ -500,8 +528,11 @@ class TestMultiGraphDebugger:
def test_multi_retrieve_when_train_begin(self, app_client, body_data, expect_file):
"""Test retrieve when train_begin."""
url = 'retrieve'
check_state(app_client, 'pending')
with self._debugger_client.get_thread_instance():
check_state(app_client)
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file)
send_and_compare_result(app_client, url, body_data, expect_file)
send_terminate_cmd(app_client)

@@ -521,6 +552,8 @@ class TestMultiGraphDebugger:
"""Test search by category request."""
with self._debugger_client.get_thread_instance():
check_state(app_client)
if self.save_results:
send_and_save_result(app_client, 'search', filter_condition, expect_file, method='get')
send_and_compare_result(app_client, 'search', filter_condition, expect_file, method='get')
send_terminate_cmd(app_client)

@@ -577,6 +610,8 @@ class TestMultiGraphDebugger:
check_state(app_client)
url = 'retrieve'
body_data = {'mode': 'all'}
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file)
send_and_compare_result(app_client, url, body_data, expect_file)
send_terminate_cmd(app_client)
finally:
@@ -598,6 +633,8 @@ class TestMultiGraphDebugger:
url = 'tensor-hits'
with self._debugger_client.get_thread_instance():
check_state(app_client)
if self.save_results:
send_and_save_result(app_client, url, body_data, expect_file, method='GET')
send_and_compare_result(app_client, url, body_data, expect_file, method='GET')
send_terminate_cmd(app_client)



+ 3
- 3
tests/st/func/debugger/utils.py View File

@@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -66,9 +66,9 @@ def send_and_compare_result(app_client, url, body_data, expect_file=None, method
compare_result_with_file(res, real_path)


def send_and_save_result(app_client, url, body_data, file_path, method='post'):
def send_and_save_result(app_client, url, body_data, file_path, method='post', full_url=False):
"""Send and save result."""
res = get_request_result(app_client, url, body_data, method=method)
res = get_request_result(app_client, url, body_data, method=method, full_url=full_url)
delete_random_items(res)
real_path = os.path.join(DEBUGGER_EXPECTED_RESULTS, 'restful_results', file_path)
json.dump(res, open(real_path, 'w'))


+ 1
- 1
tests/ut/datavisual/processors/graph_results/test_get_nodes_success_expected_results1.json View File

@@ -1 +1 @@
{"nodes":[{"attr":{},"independent_layout":false,"input":{},"name":"Default","output":{},"output_i":0,"proxy_input":{},"proxy_output":{},"subnode_count":3,"type":"name_scope"}]}
{"nodes": [{"name": "Default", "type": "name_scope", "attr": {}, "input": {}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 3, "independent_layout": false, "stack_info": []}]}

+ 1
- 1
tests/ut/datavisual/processors/graph_results/test_get_nodes_success_expected_results2.json View File

@@ -1 +1 @@
{"nodes": [{"name": "Default/conv1-Conv2d/Conv2D55", "type": "Conv2D", "attr": {"output_names": "dtype: DT_GRAPHS\nvalues {\n dtype: DT_FLOAT64\n str_val: \"output\"\n}\n", "pad_mode": "dtype: DT_FLOAT64\nstr_val: \"same\"\n"}, "input": {"Default/conv1-Conv2d/Parameter[12]_2/x": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x1": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x2": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x3": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x4": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x5": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x6": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x7": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x8": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x9": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x10": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/conv1.weight": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}}, "output": {"Default/bn1/Reshape[12]_1/Reshape6": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {"Default/conv1-Conv2d/Parameter[12]_2": {"edge_type": "data"}}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/conv1-Conv2d/Parameter[12]_2", "type": "aggregation_scope", "attr": {}, "input": {}, "output": {"Default/conv1-Conv2d/Conv2D55": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {}, "proxy_output": {"Default/conv1-Conv2d/Conv2D55": {"edge_type": "data"}}, "subnode_count": 12, "independent_layout": true}]}
{"nodes": [{"name": "Default/conv1-Conv2d/Conv2D55", "type": "Conv2D", "attr": {"output_names": "dtype: DT_GRAPHS\nvalues {\n dtype: DT_FLOAT64\n str_val: \"output\"\n}\n", "pad_mode": "dtype: DT_FLOAT64\nstr_val: \"same\"\n"}, "input": {"Default/conv1-Conv2d/Parameter[12]_2/x": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x1": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x2": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x3": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x4": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x5": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x6": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x7": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x8": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x9": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/x10": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Parameter[12]_2/conv1.weight": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}}, "output": {"Default/bn1/Reshape[12]_1/Reshape6": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {"Default/conv1-Conv2d/Parameter[12]_2": {"edge_type": "data"}}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/conv1-Conv2d/Parameter[12]_2", "type": "aggregation_scope", "attr": {}, "input": {}, "output": {"Default/conv1-Conv2d/Conv2D55": {"shape": [[]], "edge_type": "data", "independent_layout": true, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {}, "proxy_output": {"Default/conv1-Conv2d/Conv2D55": {"edge_type": "data"}}, "subnode_count": 12, "independent_layout": true, "stack_info": []}]}

+ 1
- 1
tests/ut/datavisual/processors/graph_results/test_get_nodes_success_expected_results3.json View File

@@ -1 +1 @@
{"nodes": [{"name": "Default/bn1/Reshape[12]_1/Reshape1", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add50": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape2", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add51": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape3", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add52": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape4", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add53": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape5", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add54": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape6", "type": "Reshape", "attr": {}, "input": {"Default/conv1-Conv2d/Conv2D55": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape7", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape8", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape9", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape10", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape11", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}, {"name": "Default/bn1/Reshape[12]_1/Reshape12", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false}]}
{"nodes": [{"name": "Default/bn1/Reshape[12]_1/Reshape1", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add50": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape2", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add51": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape3", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add52": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape4", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add53": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape5", "type": "Reshape", "attr": {}, "input": {"Default/bn1/Add[5]_0/Add54": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape6", "type": "Reshape", "attr": {}, "input": {"Default/conv1-Conv2d/Conv2D55": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape7", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape8", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape9", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape10", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape11", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1/Reshape[12]_1/Reshape12", "type": "Reshape", "attr": {}, "input": {"Default/bn1/x": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 0, "independent_layout": false, "stack_info": []}]}

+ 1
- 1
tests/ut/datavisual/processors/graph_results/test_get_nodes_success_expected_results4.json
File diff suppressed because it is too large
View File


+ 1
- 1
tests/ut/datavisual/processors/graph_results/test_search_single_node_success_expected_results1.json View File

@@ -1 +1 @@
{"nodes": [{"name": "Default", "type": "name_scope", "attr": {}, "input": {}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 3, "independent_layout": false}], "scope_name": "", "children": {"nodes": [{"name": "Default/conv1-Conv2d", "type": "name_scope", "attr": {}, "input": {}, "output": {"Default/bn1/Reshape[12]_1/Reshape6": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 2, "independent_layout": false}, {"name": "Default/bn1-BatchNorm2d", "type": "name_scope", "attr": {}, "input": {}, "output": {"Default/bn1/Add[5]_0/Add53": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 5, "independent_layout": false}, {"name": "Default/bn1", "type": "name_scope", "attr": {}, "input": {"Default/bn1-BatchNorm2d/tuple_getitem56": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Conv2D55": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 4, "independent_layout": false}], "scope_name": "Default", "children": {}}}
{"nodes": [{"name": "Default", "type": "name_scope", "attr": {}, "input": {}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 3, "independent_layout": false, "stack_info": []}], "scope_name": "", "children": {"nodes": [{"name": "Default/conv1-Conv2d", "type": "name_scope", "attr": {}, "input": {}, "output": {"Default/bn1/Reshape[12]_1/Reshape6": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 2, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1-BatchNorm2d", "type": "name_scope", "attr": {}, "input": {}, "output": {"Default/bn1/Add[5]_0/Add53": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 5, "independent_layout": false, "stack_info": []}, {"name": "Default/bn1", "type": "name_scope", "attr": {}, "input": {"Default/bn1-BatchNorm2d/tuple_getitem56": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}, "Default/conv1-Conv2d/Conv2D55": {"shape": [[]], "edge_type": "data", "independent_layout": false, "data_type": "DT_STRING"}}, "output": {}, "output_i": 0, "proxy_input": {}, "proxy_output": {}, "subnode_count": 4, "independent_layout": false, "stack_info": []}], "scope_name": "Default", "children": {}}}

+ 1
- 2
tests/ut/datavisual/processors/test_graph_processor.py View File

@@ -33,10 +33,9 @@ from mindinsight.datavisual.data_transform.data_manager import DataManager
from mindinsight.datavisual.processors.graph_processor import GraphProcessor
from mindinsight.datavisual.utils import crc32
from mindinsight.utils.exceptions import ParamValueError
from ..mock import MockLogger
from ....utils.log_operations import LogOperations
from ....utils.tools import compare_result_with_file, delete_files_or_dirs
from ..mock import MockLogger


class TestGraphProcessor:


+ 1
- 1
tests/ut/debugger/expected_results/graph/graph_handler_get_1_no_filter_condintion.json
File diff suppressed because it is too large
View File


+ 1
- 1
tests/ut/debugger/expected_results/graph/graph_handler_get_2_list_nodes.json
File diff suppressed because it is too large
View File


+ 1
- 1
tests/ut/debugger/expected_results/graph/graph_handler_get_3_single_node.json
File diff suppressed because it is too large
View File


Loading…
Cancel
Save