cntk.logging.graph module¶
-
depth_first_search
(root, visitor, depth=0)[source]¶ Generic function that walks through the graph starting at
root
and uses functionvisitor
on each node to check whether it should be returned.Parameters: - root (
Function
orVariable
) – the root to start the journey from - visitor (Python function or lambda) – function that takes a node as
argument and returns
True
if that node should be returned. - depth (int, default 0) – how deep into the block hierarchy the DFS algorithm should go into. Set to -1 for infinite depth.
Returns: List of functions, for which
visitor
wasTrue
- root (
-
find_all_with_name
(node, node_name, depth=0)[source]¶ Finds functions in the graph starting from
node
and doing a depth-first search.Parameters: Returns: List of primitive (or block) functions having the specified name
See also
find_all_with_name()
in classFunction
.
-
find_by_name
(node, node_name, depth=0)[source]¶ Finds a function in the graph starting from
node
and doing a depth-first search. It assumes that the name occurs only once.Parameters: Returns: Primitive (or block) function having the specified name
See also
find_by_name()
in classFunction
.
-
find_by_uid
(node, node_uid, depth=0)[source]¶ Finds a function in the graph based on its UID starting from
node
and doing a depth-first search. It assumes that the name occurs only once.Parameters: Returns: Primitive (or block) function having the specified name
See also
find_by_uid()
in classFunction
.
-
get_node_outputs
(node, depth=0)[source]¶ Walks through every node of the graph starting at
node
and returns a list of all node outputs.Parameters: node (graph node) – the node to start the journey from Returns: A list of all node outputs
-
plot
(root, filename=None)[source]¶ Walks through every node of the graph starting at
root
, creates a network graph, and returns a network description. Iffilename
is specified, it outputs a DOT, PNG, PDF, or SVG file depending on the file name’s suffix.Requirements:
Parameters: - node (graph node) – the node to start the journey from
- filename (str, default None) – file with extension ‘.dot’, ‘png’, ‘pdf’, or ‘svg’ to denote what format should be written. If None then nothing will be plotted, and the returned string can be used to debug the graph.
Returns: str describing the graph