Browse Source

change response of names interface from list to tree.

tags/v1.1.0
wangshuide2020 5 years ago
parent
commit
7e29177656
14 changed files with 139 additions and 128 deletions
  1. +0
    -22
      mindinsight/datavisual/data_transform/graph/graph.py
  2. +123
    -0
      mindinsight/datavisual/data_transform/graph/msgraph.py
  3. +0
    -0
      mindinsight/datavisual/data_transform/graph/node_tree.py
  4. +6
    -3
      mindinsight/datavisual/processors/graph_processor.py
  5. +0
    -93
      mindinsight/debugger/stream_cache/debugger_graph.py
  6. +1
    -1
      mindinsight/debugger/stream_handler/graph_handler.py
  7. +1
    -1
      tests/st/func/datavisual/graph/graph_results/test_search_nodes_success_result1.json
  8. +1
    -1
      tests/st/func/debugger/expect_results/restful_results/search_unwatched_leaf_node.json
  9. +1
    -1
      tests/ut/datavisual/processors/graph_results/test_search_node_names_with_offset_expected_results1.json
  10. +1
    -1
      tests/ut/datavisual/processors/graph_results/test_search_node_names_with_search_content_expected_results1.json
  11. +1
    -1
      tests/ut/datavisual/processors/graph_results/test_search_node_names_with_search_content_expected_results2.json
  12. +2
    -2
      tests/ut/datavisual/processors/test_graph_processor.py
  13. +1
    -1
      tests/ut/debugger/expected_results/graph/search_node_1.json
  14. +1
    -1
      tests/ut/debugger/expected_results/graph/search_nodes_0.json

+ 0
- 22
mindinsight/datavisual/data_transform/graph/graph.py View File

@@ -147,28 +147,6 @@ class Graph:
nodes.append(node.to_dict()) nodes.append(node.to_dict())
return nodes return nodes


def search_node_names(self, content, offset, limit):
"""
Search node names by content.

Args:
content (Union[str, None]): This content can be the key content of the node to search,
if None, will get all node names.
offset (int): An offset for page. Ex, offset is 0, mean current page is 1.
limit (int): An offset for page. Ex, offset is 0, mean current page is 1.

Returns:
list[str], a list of node names.
"""
if content is not None:
content = content.lower()
catch_names = [name for name in self._normal_node_map if content in name.lower()]
else:
catch_names = list(self._normal_node_map)
catch_names = sorted(catch_names)
real_offset = offset * limit
return catch_names[real_offset:real_offset+limit]

def search_single_node(self, node_name): def search_single_node(self, node_name):
""" """
Search node, and return every layer nodes until this node. Search node, and return every layer nodes until this node.


+ 123
- 0
mindinsight/datavisual/data_transform/graph/msgraph.py View File

@@ -16,6 +16,7 @@
from mindinsight.datavisual.common.log import logger from mindinsight.datavisual.common.log import logger
from mindinsight.datavisual.proto_files.mindinsight_anf_ir_pb2 import DataType from mindinsight.datavisual.proto_files.mindinsight_anf_ir_pb2 import DataType
from mindinsight.datavisual.common.enums import PluginNameEnum from mindinsight.datavisual.common.enums import PluginNameEnum
from .node_tree import NodeTree
from .node import Node from .node import Node
from .node import NodeTypeEnum from .node import NodeTypeEnum
from .graph import Graph from .graph import Graph
@@ -205,6 +206,128 @@ class MSGraph(Graph):


return data_type_name return data_type_name


def get_nodes(self, searched_node_list):
"""
Get node tree by a searched_node_list.

Args:
searched_node_list (list[Node]): A list of nodes that
matches the given search pattern.

Returns:
A list of dict including the searched nodes.
[{
"name": "Default",
"type": "name_scope",
"nodes": [{
"name": "Default/Conv2D1",
"type": "name_scope",
"nodes": [{
...
}]
}]
},
{
"name": "Gradients",
"type": "name_scope",
"nodes": [{
"name": "Gradients/Default",
"type": "name_scope",
"nodes": [{
...
}]
}]
"""
# save the node in the NodeTree
root = NodeTree()
for node in searched_node_list:
self._build_node_tree(root, node.name, node.type)

# get the searched nodes in the NodeTree and reorganize them
searched_list = []
self._traverse_node_tree(root, searched_list)

return searched_list

def search_leaf_nodes_by_pattern(self, pattern):
"""
Search leaf node by a given pattern.

Args:
pattern (Union[str, None]): The pattern of the node to search,
if None, return all node names.

Returns:
list[Node], a list of nodes.
"""
if pattern is not None:
pattern = pattern.lower()
searched_nodes = [
node for name, node in self._leaf_nodes.items()
if pattern in name.lower()
]
else:
searched_nodes = [node for node in self._leaf_nodes.values()]
return searched_nodes

def search_nodes_by_pattern(self, pattern):
"""
Search node by a given pattern.

Search node which pattern is the part of the last node. Example: pattern=ops, node1=default/ops,
node2=default/ops/weight, so node2 will be ignore and only node1 will be return.

Args:
pattern (Union[str, None]): The pattern of the node to search.

Returns:
list[Node], a list of nodes.
"""
searched_nodes = []
if pattern and pattern != '/':
pattern = pattern.lower()
for name, node in self._normal_node_map.items():
name = name.lower()
pattern_index = name.rfind(pattern)
if pattern_index >= 0 and name.find('/', pattern_index + len(pattern)) == -1:
searched_nodes.append(node)
return searched_nodes

def _build_node_tree(self, root, node_name, node_type):
"""
Build node tree.

Args:
root (NodeTree): Root node of node tree.
node_name (str): Node name.
node_type (str): Node type.
"""
scope_names = node_name.split('/')
cur_node = root
full_name = ""
for scope_name in scope_names[:-1]:
full_name = '/'.join([full_name, scope_name]) if full_name else scope_name
scope_node = self._get_normal_node(node_name=full_name)
sub_node = cur_node.get(scope_name)
if not sub_node:
sub_node = cur_node.add(scope_name, scope_node.type)
cur_node = sub_node
cur_node.add(scope_names[-1], node_type)

def _traverse_node_tree(self, cur_node, search_node_list):
"""Traverse the node tree and construct the searched nodes list."""
if not cur_node.get_children():
return
for _, sub_node in cur_node.get_children():
sub_nodes = []
self._traverse_node_tree(sub_node, sub_nodes)
sub_node_dict = {
'name': sub_node.node_name,
'type': sub_node.node_type,
'nodes': sub_nodes
}
search_node_list.append(sub_node_dict)

def _parse_inputs(self, input_protos, node): def _parse_inputs(self, input_protos, node):
""" """
Parse `anf_ir_pb2.InputProto` object. Parse `anf_ir_pb2.InputProto` object.


mindinsight/debugger/stream_cache/node.py → mindinsight/datavisual/data_transform/graph/node_tree.py View File


+ 6
- 3
mindinsight/datavisual/processors/graph_processor.py View File

@@ -103,12 +103,15 @@ class GraphProcessor(BaseProcessor):
limit (int): The max data items for per page. limit (int): The max data items for per page.


Returns: Returns:
TypedDict('Names', {'names': list[str]}), {"names": ["node_names"]}.
Dict, the searched nodes.
""" """
offset = Validation.check_offset(offset=offset) offset = Validation.check_offset(offset=offset)
limit = Validation.check_limit(limit, min_value=1, max_value=1000) limit = Validation.check_limit(limit, min_value=1, max_value=1000)
names = self._graph.search_node_names(search_content, offset, limit)
return {"names": names}
nodes = self._graph.search_nodes_by_pattern(search_content)
real_offset = offset * limit
search_nodes = self._graph.get_nodes(nodes[real_offset:real_offset + limit])

return {"nodes": search_nodes}


def search_single_node(self, name): def search_single_node(self, name):
""" """


+ 0
- 93
mindinsight/debugger/stream_cache/debugger_graph.py View File

@@ -19,14 +19,10 @@ from mindinsight.datavisual.data_transform.graph.msgraph import MSGraph
from mindinsight.debugger.common.exceptions.exceptions import \ from mindinsight.debugger.common.exceptions.exceptions import \
DebuggerNodeNotInGraphError, DebuggerParamValueError DebuggerNodeNotInGraphError, DebuggerParamValueError
from mindinsight.debugger.common.log import logger as log from mindinsight.debugger.common.log import logger as log
from .node import NodeTree




class DebuggerGraph(MSGraph): class DebuggerGraph(MSGraph):
"""The `DebuggerGraph` object provides interfaces to describe a debugger graph.""" """The `DebuggerGraph` object provides interfaces to describe a debugger graph."""
def __init__(self):
super(DebuggerGraph, self).__init__()
self._node_tree = None


def get_node_name_by_full_name(self, full_name): def get_node_name_by_full_name(self, full_name):
"""Get node name by full names.""" """Get node name by full names."""
@@ -44,95 +40,6 @@ class DebuggerGraph(MSGraph):


return node.full_name if node else '' return node.full_name if node else ''


def get_nodes(self, searched_node_list):
"""
Search node names by a given pattern.

Args:
searched_node_list (list[Node]): A list of leaf nodes that
matches the given search pattern.

Returns:
A list of dict including the searched nodes.
[{
"name": "Default",
"type": "name_scope",
"nodes": [{
"name": "Default/Conv2D1",
"type": "name_scope",
"nodes": [{
...
}]
}]
},
{
"name": "Gradients",
"type": "name_scope",
"nodes": [{
"name": "Gradients/Default",
"type": "name_scope",
"nodes": [{
...
}]
}]
"""
# save the node in the NodeTree
self._node_tree = NodeTree()
for node in searched_node_list:
self._build_node_tree(node.name, node.type)

# get the searched nodes in the NodeTree and reorganize them
searched_list = []
self._traverse_node_tree(self._node_tree, searched_list)

return searched_list

def search_nodes_by_pattern(self, pattern):
"""
Search node by a given pattern.

Args:
pattern (Union[str, None]): The pattern of the node to search,
if None, return all node names.

Returns:
list[Node], a list of node.
"""
if pattern is not None:
pattern = pattern.lower()
searched_nodes = [
node for name, node in self._leaf_nodes.items()
if pattern in name.lower()
]
else:
searched_nodes = [node for _, node in self._leaf_nodes.items()]
return searched_nodes

def _build_node_tree(self, node_name, node_type):
"""Build node tree."""
scope_names = node_name.split('/')
cur_node = self._node_tree
for scope_name in scope_names[:-1]:
sub_node = cur_node.get(scope_name)
if not sub_node:
sub_node = cur_node.add(scope_name)
cur_node = sub_node
cur_node.add(scope_names[-1], node_type)

def _traverse_node_tree(self, cur_node, search_node_list):
"""Traverse the watch nodes and update the total watched node list."""
if not cur_node.get_children():
return
for _, sub_node in cur_node.get_children():
sub_nodes = []
self._traverse_node_tree(sub_node, sub_nodes)
sub_node_dict = {
'name': sub_node.node_name,
'type': sub_node.node_type,
'nodes': sub_nodes
}
search_node_list.append(sub_node_dict)

def get_node_type(self, node_name): def get_node_type(self, node_name):
""" """
Get the type of the node. Get the type of the node.


+ 1
- 1
mindinsight/debugger/stream_handler/graph_handler.py View File

@@ -153,7 +153,7 @@ class GraphHandler(StreamHandlerBase):
Returns: Returns:
list[Node], a list of node. list[Node], a list of node.
""" """
return self._graph.search_nodes_by_pattern(scope_name)
return self._graph.search_leaf_nodes_by_pattern(scope_name)


def get_searched_node_list(self): def get_searched_node_list(self):
"""Get searched node list.""" """Get searched node list."""


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

@@ -1 +1 @@
{"names":["Default/bn1","Default/bn1-BatchNorm2d","Default/bn1-BatchNorm2d/Parameter[22]_3","Default/bn1-BatchNorm2d/Parameter[22]_3/conv1.weight","Default/bn1-BatchNorm2d/Parameter[22]_3/x","Default/bn1-BatchNorm2d/Parameter[22]_3/x1","Default/bn1-BatchNorm2d/Parameter[22]_3/x10","Default/bn1-BatchNorm2d/Parameter[22]_3/x11","Default/bn1-BatchNorm2d/Parameter[22]_3/x12","Default/bn1-BatchNorm2d/Parameter[22]_3/x13","Default/bn1-BatchNorm2d/Parameter[22]_3/x14","Default/bn1-BatchNorm2d/Parameter[22]_3/x15","Default/bn1-BatchNorm2d/Parameter[22]_3/x16","Default/bn1-BatchNorm2d/Parameter[22]_3/x17","Default/bn1-BatchNorm2d/Parameter[22]_3/x18","Default/bn1-BatchNorm2d/Parameter[22]_3/x19","Default/bn1-BatchNorm2d/Parameter[22]_3/x2","Default/bn1-BatchNorm2d/Parameter[22]_3/x20","Default/bn1-BatchNorm2d/Parameter[22]_3/x3","Default/bn1-BatchNorm2d/Parameter[22]_3/x4","Default/bn1-BatchNorm2d/Parameter[22]_3/x5","Default/bn1-BatchNorm2d/Parameter[22]_3/x6","Default/bn1-BatchNorm2d/Parameter[22]_3/x7","Default/bn1-BatchNorm2d/Parameter[22]_3/x8","Default/bn1-BatchNorm2d/Parameter[22]_3/x9","Default/bn1-BatchNorm2d/cst13","Default/bn1-BatchNorm2d/cst25","Default/bn1-BatchNorm2d/tuple_getitem105","Default/bn1-BatchNorm2d/tuple_getitem56","Default/bn1/Add[5]_0","Default/bn1/Add[5]_0/Add50","Default/bn1/Add[5]_0/Add51","Default/bn1/Add[5]_0/Add52","Default/bn1/Add[5]_0/Add53","Default/bn1/Add[5]_0/Add54","Default/bn1/Reshape[12]_1","Default/bn1/Reshape[12]_1/Reshape1","Default/bn1/Reshape[12]_1/Reshape10","Default/bn1/Reshape[12]_1/Reshape11","Default/bn1/Reshape[12]_1/Reshape12","Default/bn1/Reshape[12]_1/Reshape2","Default/bn1/Reshape[12]_1/Reshape3","Default/bn1/Reshape[12]_1/Reshape4","Default/bn1/Reshape[12]_1/Reshape5","Default/bn1/Reshape[12]_1/Reshape6","Default/bn1/Reshape[12]_1/Reshape7","Default/bn1/Reshape[12]_1/Reshape8","Default/bn1/Reshape[12]_1/Reshape9","Default/bn1/x","Default/bn1/x11"]}
{"nodes": [{"name": "Default", "type": "name_scope", "nodes": [{"name": "Default/bn1-BatchNorm2d", "type": "name_scope", "nodes": []}, {"name": "Default/bn1", "type": "name_scope", "nodes": []}]}]}

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

@@ -1 +1 @@
{"nodes": [{"name": "Default", "type": null, "nodes": [{"name": "Default/optimizer-Momentum", "type": null, "nodes": [{"name": "Default/optimizer-Momentum/Parameter[18]_7", "type": null, "nodes": [{"name": "Default/optimizer-Momentum/Parameter[18]_7/moments.fc3.bias", "type": "Parameter", "nodes": [], "watched": 0}], "watched": 1}], "watched": 1}], "watched": 1}]}
{"nodes": [{"name": "Default", "type": "name_scope", "nodes": [{"name": "Default/optimizer-Momentum", "type": "name_scope", "nodes": [{"name": "Default/optimizer-Momentum/Parameter[18]_7", "type": "aggregation_scope", "nodes": [{"name": "Default/optimizer-Momentum/Parameter[18]_7/moments.fc3.bias", "type": "Parameter", "nodes": [], "watched": 0}], "watched": 1}], "watched": 1}], "watched": 1}]}

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

@@ -1 +1 @@
{"names":["Default/bn1-BatchNorm2d/Parameter[22]_3/conv1.weight","Default/bn1-BatchNorm2d/Parameter[22]_3/x","Default/bn1-BatchNorm2d/Parameter[22]_3/x1"]}
{"nodes": [{"name": "Default", "type": "name_scope", "nodes": [{"name": "Default/bn1", "type": "name_scope", "nodes": []}]}]}

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

@@ -1 +1 @@
{"names":["Default","Default/bn1","Default/bn1-BatchNorm2d","Default/bn1-BatchNorm2d/Parameter[22]_3","Default/bn1-BatchNorm2d/Parameter[22]_3/conv1.weight","Default/bn1-BatchNorm2d/Parameter[22]_3/x","Default/bn1-BatchNorm2d/Parameter[22]_3/x1","Default/bn1-BatchNorm2d/Parameter[22]_3/x10","Default/bn1-BatchNorm2d/Parameter[22]_3/x11","Default/bn1-BatchNorm2d/Parameter[22]_3/x12","Default/bn1-BatchNorm2d/Parameter[22]_3/x13","Default/bn1-BatchNorm2d/Parameter[22]_3/x14","Default/bn1-BatchNorm2d/Parameter[22]_3/x15","Default/bn1-BatchNorm2d/Parameter[22]_3/x16","Default/bn1-BatchNorm2d/Parameter[22]_3/x17","Default/bn1-BatchNorm2d/Parameter[22]_3/x18","Default/bn1-BatchNorm2d/Parameter[22]_3/x19","Default/bn1-BatchNorm2d/Parameter[22]_3/x2","Default/bn1-BatchNorm2d/Parameter[22]_3/x20","Default/bn1-BatchNorm2d/Parameter[22]_3/x3","Default/bn1-BatchNorm2d/Parameter[22]_3/x4","Default/bn1-BatchNorm2d/Parameter[22]_3/x5","Default/bn1-BatchNorm2d/Parameter[22]_3/x6","Default/bn1-BatchNorm2d/Parameter[22]_3/x7","Default/bn1-BatchNorm2d/Parameter[22]_3/x8","Default/bn1-BatchNorm2d/Parameter[22]_3/x9","Default/bn1-BatchNorm2d/cst13","Default/bn1-BatchNorm2d/cst25","Default/bn1-BatchNorm2d/tuple_getitem105","Default/bn1-BatchNorm2d/tuple_getitem56","Default/bn1/Add[5]_0","Default/bn1/Add[5]_0/Add50","Default/bn1/Add[5]_0/Add51","Default/bn1/Add[5]_0/Add52","Default/bn1/Add[5]_0/Add53","Default/bn1/Add[5]_0/Add54","Default/bn1/Reshape[12]_1","Default/bn1/Reshape[12]_1/Reshape1","Default/bn1/Reshape[12]_1/Reshape10","Default/bn1/Reshape[12]_1/Reshape11","Default/bn1/Reshape[12]_1/Reshape12","Default/bn1/Reshape[12]_1/Reshape2","Default/bn1/Reshape[12]_1/Reshape3","Default/bn1/Reshape[12]_1/Reshape4","Default/bn1/Reshape[12]_1/Reshape5","Default/bn1/Reshape[12]_1/Reshape6","Default/bn1/Reshape[12]_1/Reshape7","Default/bn1/Reshape[12]_1/Reshape8","Default/bn1/Reshape[12]_1/Reshape9","Default/bn1/x","Default/bn1/x11","Default/conv1-Conv2d","Default/conv1-Conv2d/Conv2D55","Default/conv1-Conv2d/Parameter[12]_2","Default/conv1-Conv2d/Parameter[12]_2/conv1.weight","Default/conv1-Conv2d/Parameter[12]_2/x","Default/conv1-Conv2d/Parameter[12]_2/x1","Default/conv1-Conv2d/Parameter[12]_2/x10","Default/conv1-Conv2d/Parameter[12]_2/x2","Default/conv1-Conv2d/Parameter[12]_2/x3","Default/conv1-Conv2d/Parameter[12]_2/x4","Default/conv1-Conv2d/Parameter[12]_2/x5","Default/conv1-Conv2d/Parameter[12]_2/x6","Default/conv1-Conv2d/Parameter[12]_2/x7","Default/conv1-Conv2d/Parameter[12]_2/x8","Default/conv1-Conv2d/Parameter[12]_2/x9"]}
{"nodes": []}

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

@@ -1 +1 @@
{"names":["Default/bn1","Default/bn1-BatchNorm2d","Default/bn1-BatchNorm2d/Parameter[22]_3","Default/bn1-BatchNorm2d/Parameter[22]_3/conv1.weight","Default/bn1-BatchNorm2d/Parameter[22]_3/x","Default/bn1-BatchNorm2d/Parameter[22]_3/x1","Default/bn1-BatchNorm2d/Parameter[22]_3/x10","Default/bn1-BatchNorm2d/Parameter[22]_3/x11","Default/bn1-BatchNorm2d/Parameter[22]_3/x12","Default/bn1-BatchNorm2d/Parameter[22]_3/x13","Default/bn1-BatchNorm2d/Parameter[22]_3/x14","Default/bn1-BatchNorm2d/Parameter[22]_3/x15","Default/bn1-BatchNorm2d/Parameter[22]_3/x16","Default/bn1-BatchNorm2d/Parameter[22]_3/x17","Default/bn1-BatchNorm2d/Parameter[22]_3/x18","Default/bn1-BatchNorm2d/Parameter[22]_3/x19","Default/bn1-BatchNorm2d/Parameter[22]_3/x2","Default/bn1-BatchNorm2d/Parameter[22]_3/x20","Default/bn1-BatchNorm2d/Parameter[22]_3/x3","Default/bn1-BatchNorm2d/Parameter[22]_3/x4","Default/bn1-BatchNorm2d/Parameter[22]_3/x5","Default/bn1-BatchNorm2d/Parameter[22]_3/x6","Default/bn1-BatchNorm2d/Parameter[22]_3/x7","Default/bn1-BatchNorm2d/Parameter[22]_3/x8","Default/bn1-BatchNorm2d/Parameter[22]_3/x9","Default/bn1-BatchNorm2d/cst13","Default/bn1-BatchNorm2d/cst25","Default/bn1-BatchNorm2d/tuple_getitem105","Default/bn1-BatchNorm2d/tuple_getitem56","Default/bn1/Add[5]_0","Default/bn1/Add[5]_0/Add50","Default/bn1/Add[5]_0/Add51","Default/bn1/Add[5]_0/Add52","Default/bn1/Add[5]_0/Add53","Default/bn1/Add[5]_0/Add54","Default/bn1/Reshape[12]_1","Default/bn1/Reshape[12]_1/Reshape1","Default/bn1/Reshape[12]_1/Reshape10","Default/bn1/Reshape[12]_1/Reshape11","Default/bn1/Reshape[12]_1/Reshape12","Default/bn1/Reshape[12]_1/Reshape2","Default/bn1/Reshape[12]_1/Reshape3","Default/bn1/Reshape[12]_1/Reshape4","Default/bn1/Reshape[12]_1/Reshape5","Default/bn1/Reshape[12]_1/Reshape6","Default/bn1/Reshape[12]_1/Reshape7","Default/bn1/Reshape[12]_1/Reshape8","Default/bn1/Reshape[12]_1/Reshape9","Default/bn1/x","Default/bn1/x11"]}
{"nodes": [{"name": "Default", "type": "name_scope", "nodes": [{"name": "Default/bn1-BatchNorm2d", "type": "name_scope", "nodes": []}, {"name": "Default/bn1", "type": "name_scope", "nodes": []}]}]}

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

@@ -149,7 +149,7 @@ class TestGraphProcessor:
graph_processor = GraphProcessor(self._train_id, self._mock_data_manager) graph_processor = GraphProcessor(self._train_id, self._mock_data_manager)
results = graph_processor.search_node_names(search_content, test_offset, test_limit) results = graph_processor.search_node_names(search_content, test_offset, test_limit)
if search_content == 'not_exist_search_content': if search_content == 'not_exist_search_content':
expected_results = {'names': []}
expected_results = {'nodes': []}
assert results == expected_results assert results == expected_results
else: else:
expected_file_path = os.path.join(self.graph_results_dir, result_file) expected_file_path = os.path.join(self.graph_results_dir, result_file)
@@ -173,7 +173,7 @@ class TestGraphProcessor:
"""Test search node names with offset.""" """Test search node names with offset."""
test_search_content = "Default/bn1" test_search_content = "Default/bn1"
test_offset = offset test_offset = offset
test_limit = 3
test_limit = 1


graph_processor = GraphProcessor(self._train_id, self._mock_data_manager) graph_processor = GraphProcessor(self._train_id, self._mock_data_manager)
results = graph_processor.search_node_names(test_search_content, test_offset, test_limit) results = graph_processor.search_node_names(test_search_content, test_offset, test_limit)


+ 1
- 1
tests/ut/debugger/expected_results/graph/search_node_1.json View File

@@ -1 +1 @@
{"nodes": [{"name": "Default", "type": null, "nodes": [{"name": "Default/network-WithLossCell", "type": null, "nodes": [{"name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits", "type": null, "nodes": [{"name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/cst1", "type": "Const", "nodes": []}, {"name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/cst2", "type": "Const", "nodes": []}]}]}, {"name": "Default/tuple_getitem[10]_0", "type": null, "nodes": [{"name": "Default/tuple_getitem[10]_0/cst3", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst4", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst5", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst6", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst7", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst27", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst28", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst32", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst33", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst37", "type": "Const", "nodes": []}]}, {"name": "Default/optimizer-Momentum", "type": null, "nodes": [{"name": "Default/optimizer-Momentum/tuple_getitem[16]_2", "type": null, "nodes": [{"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst9", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst10", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst12", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst13", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst15", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst16", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst18", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst19", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst21", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst22", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst24", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst25", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst29", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst30", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst34", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst35", "type": "Const", "nodes": []}]}, {"name": "Default/optimizer-Momentum/Depend[8]_4", "type": null, "nodes": [{"name": "Default/optimizer-Momentum/Depend[8]_4/cst11", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/Depend[8]_4/cst14", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/Depend[8]_4/cst17", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/Depend[8]_4/cst20", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/Depend[8]_4/cst23", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/Depend[8]_4/cst26", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/Depend[8]_4/cst31", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/Depend[8]_4/cst36", "type": "Const", "nodes": []}]}]}]}, {"name": "Gradients", "type": null, "nodes": [{"name": "Gradients/Default", "type": null, "nodes": [{"name": "Gradients/Default/network-WithLossCell", "type": null, "nodes": [{"name": "Gradients/Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits", "type": null, "nodes": [{"name": "Gradients/Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/gradSoftmaxCrossEntropyWithLogits", "type": null, "nodes": [{"name": "Gradients/Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/gradSoftmaxCrossEntropyWithLogits/cst8", "type": "Const", "nodes": []}]}]}]}]}]}]}
{"nodes": [{"name": "Default", "type": "name_scope", "nodes": [{"name": "Default/network-WithLossCell", "type": "name_scope", "nodes": [{"name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits", "type": "name_scope", "nodes": [{"name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/cst1", "type": "Const", "nodes": []}, {"name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/cst2", "type": "Const", "nodes": []}]}]}, {"name": "Default/tuple_getitem[10]_0", "type": "aggregation_scope", "nodes": [{"name": "Default/tuple_getitem[10]_0/cst3", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst4", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst5", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst6", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst7", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst27", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst28", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst32", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst33", "type": "Const", "nodes": []}, {"name": "Default/tuple_getitem[10]_0/cst37", "type": "Const", "nodes": []}]}, {"name": "Default/optimizer-Momentum", "type": "name_scope", "nodes": [{"name": "Default/optimizer-Momentum/tuple_getitem[16]_2", "type": "aggregation_scope", "nodes": [{"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst9", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst10", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst12", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst13", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst15", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst16", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst18", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst19", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst21", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst22", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst24", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst25", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst29", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst30", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst34", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/tuple_getitem[16]_2/cst35", "type": "Const", "nodes": []}]}, {"name": "Default/optimizer-Momentum/Depend[8]_4", "type": "aggregation_scope", "nodes": [{"name": "Default/optimizer-Momentum/Depend[8]_4/cst11", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/Depend[8]_4/cst14", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/Depend[8]_4/cst17", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/Depend[8]_4/cst20", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/Depend[8]_4/cst23", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/Depend[8]_4/cst26", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/Depend[8]_4/cst31", "type": "Const", "nodes": []}, {"name": "Default/optimizer-Momentum/Depend[8]_4/cst36", "type": "Const", "nodes": []}]}]}]}, {"name": "Gradients", "type": "name_scope", "nodes": [{"name": "Gradients/Default", "type": "name_scope", "nodes": [{"name": "Gradients/Default/network-WithLossCell", "type": "name_scope", "nodes": [{"name": "Gradients/Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits", "type": "name_scope", "nodes": [{"name": "Gradients/Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/gradSoftmaxCrossEntropyWithLogits", "type": "name_scope", "nodes": [{"name": "Gradients/Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/gradSoftmaxCrossEntropyWithLogits/cst8", "type": "Const", "nodes": []}]}]}]}]}]}]}

+ 1
- 1
tests/ut/debugger/expected_results/graph/search_nodes_0.json View File

@@ -1 +1 @@
{"nodes": [{"name": "Default", "type": null, "nodes": [{"name": "Default/network-WithLossCell", "type": null, "nodes": [{"name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits", "type": null, "nodes": [{"name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/OneHot-op0", "type": "OneHot", "nodes": []}, {"name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/SoftmaxCrossEntropyWithLogits-op18", "type": "SoftmaxCrossEntropyWithLogits", "nodes": []}, {"name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/ReduceMean-op60", "type": "ReduceMean", "nodes": []}, {"name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/args1", "type": "Parameter", "nodes": []}, {"name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/cst1", "type": "Const", "nodes": []}, {"name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/cst2", "type": "Const", "nodes": []}]}]}]}, {"name": "Gradients", "type": null, "nodes": [{"name": "Gradients/Default", "type": null, "nodes": [{"name": "Gradients/Default/network-WithLossCell", "type": null, "nodes": [{"name": "Gradients/Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits", "type": null, "nodes": [{"name": "Gradients/Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/gradSoftmaxCrossEntropyWithLogits", "type": null, "nodes": [{"name": "Gradients/Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/gradSoftmaxCrossEntropyWithLogits/Mul-op20", "type": "Mul", "nodes": []}, {"name": "Gradients/Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/gradSoftmaxCrossEntropyWithLogits/cst8", "type": "Const", "nodes": []}]}]}]}]}]}]}
{"nodes": [{"name": "Default", "type": "name_scope", "nodes": [{"name": "Default/network-WithLossCell", "type": "name_scope", "nodes": [{"name": "Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits", "type": "name_scope", "nodes": []}]}]}, {"name": "Gradients", "type": "name_scope", "nodes": [{"name": "Gradients/Default", "type": "name_scope", "nodes": [{"name": "Gradients/Default/network-WithLossCell", "type": "name_scope", "nodes": [{"name": "Gradients/Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits", "type": "name_scope", "nodes": [{"name": "Gradients/Default/network-WithLossCell/_loss_fn-SoftmaxCrossEntropyWithLogits/gradSoftmaxCrossEntropyWithLogits", "type": "name_scope", "nodes": []}]}]}]}]}]}

Loading…
Cancel
Save