def print_all_node_names(model_file, is_BrainScript=True):
    loaded_model = load_model(model_file)
    if is_BrainScript:
        loaded_model = combine([loaded_model.outputs[0]])
    node_list = graph.depth_first_search(loaded_model, lambda x: x.is_output)
    print("printing node information in the format")
    print("node name (tensor shape)")
    for node in node_list:
        print(node.name, node.shape)
Exemple #2
0
def print_all_node_names(model_file, is_BrainScript=True):
    loaded_model = load_model(model_file)
    if is_BrainScript:
        loaded_model = combine([loaded_model.outputs[0]])
    node_list = graph.depth_first_search(loaded_model,
                                         lambda x: isinstance(x, Function))
    print("printing node information in the format")
    for node in node_list:
        print("Node name:", node.name)
        for out in node.outputs:
            print("Output name and shape:", out.name, out.shape)
Exemple #3
0
def _nodes_to_debug(model):
    from cntk.graph import depth_first_search

    def node_filter(x):
        if hasattr(x, 'op_name') and x.op_name in ['NoOp']:
            return False
        else:
            return True

    nodes = set(depth_first_search(model, lambda x: True))

    uf_nodes = [n for n in nodes if hasattr(n, 'op_name')
                and n.op_name == 'UserFunction']

    already_covered = [n.inputs[0].owner if n.inputs[0].is_output else
                       n.inputs[0] for n in uf_nodes]
    to_remove = [n.uid for n in (already_covered + uf_nodes)]

    return [n for n in nodes if n.uid not in to_remove]
Exemple #4
0
def _nodes_to_debug(model):
    from cntk.graph import depth_first_search

    def node_filter(x):
        if hasattr(x, 'op_name') and x.op_name in ['NoOp']:
            return False
        else:
            return True

    nodes = set(depth_first_search(model, lambda x: True))

    uf_nodes = [
        n for n in nodes
        if hasattr(n, 'op_name') and n.op_name == 'UserFunction'
    ]

    already_covered = [
        n.inputs[0].owner if n.inputs[0].is_output else n.inputs[0]
        for n in uf_nodes
    ]
    to_remove = [n.uid for n in (already_covered + uf_nodes)]

    return [n for n in nodes if n.uid not in to_remove]