def _get_nodes_from_symbol(sym):
if not isinstance(sym, Symbol):<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>'.format(str(type(sym))))<EOL><DEDENT>conf = json.loads(sym.tojson())<EOL>nodes = conf['<STR_LIT>']<EOL>data2op = {}  <EOL>for i, node in enumerate(nodes):<EOL><INDENT>if node['<STR_LIT>'] != '<STR_LIT:null>':  <EOL><INDENT>input_list = node['<STR_LIT>']<EOL>for idx in input_list:<EOL><INDENT>if idx[<NUM_LIT:0>] == <NUM_LIT:0>:  <EOL><INDENT>continue<EOL><DEDENT>if idx[<NUM_LIT:0>] in data2op:<EOL><INDENT>data2op[idx[<NUM_LIT:0>]].append(i)<EOL><DEDENT>else:<EOL><INDENT>data2op[idx[<NUM_LIT:0>]] = [i]<EOL><DEDENT><DEDENT><DEDENT><DEDENT>node_defs = []<EOL>for i, node in enumerate(nodes):<EOL><INDENT>node_name = node['<STR_LIT:name>']<EOL>op_name = node['<STR_LIT>']<EOL>kwargs = {'<STR_LIT>': op_name, '<STR_LIT:name>': node_name}<EOL>if op_name != '<STR_LIT:null>':  <EOL><INDENT>inputs = []<EOL>input_list = node['<STR_LIT>']<EOL>for idx in input_list:<EOL><INDENT>input_node = nodes[idx[<NUM_LIT:0>]]<EOL>input_node_name = input_node['<STR_LIT:name>']<EOL>if input_node['<STR_LIT>'] != '<STR_LIT:null>':<EOL><INDENT>inputs.append(_scoped_name(input_node_name, input_node_name))<EOL><DEDENT>elif idx[<NUM_LIT:0>] in data2op and len(data2op[idx[<NUM_LIT:0>]]) == <NUM_LIT:1> and data2op[idx[<NUM_LIT:0>]][<NUM_LIT:0>] == i:<EOL><INDENT>inputs.append(_scoped_name(node_name, input_node_name))<EOL><DEDENT>else:  <EOL><INDENT>inputs.append(input_node_name)<EOL><DEDENT><DEDENT>kwargs['<STR_LIT:input>'] = inputs<EOL>kwargs['<STR_LIT:name>'] = _scoped_name(node_name, node_name)<EOL><DEDENT>elif i in data2op and len(data2op[i]) == <NUM_LIT:1>:<EOL><INDENT>op_node_name = nodes[data2op[i][<NUM_LIT:0>]]['<STR_LIT:name>']<EOL>kwargs['<STR_LIT:name>'] = _scoped_name(op_node_name, node_name)<EOL><DEDENT>if '<STR_LIT>' in node:<EOL><INDENT>attr = json.dumps(node['<STR_LIT>'], sort_keys=True).replace("<STR_LIT>", '<STR_LIT:U+0020>')<EOL>attr = {'<STR_LIT>': AttrValue(s=attr.encode(encoding='<STR_LIT:utf-8>'))}<EOL>kwargs['<STR_LIT>'] = attr<EOL><DEDENT>node_def = NodeDef(**kwargs)<EOL>node_defs.append(node_def)<EOL><DEDENT>return node_defs<EOL>
Given a symbol and shapes, return a list of `NodeDef`s for visualizing the
    the graph in TensorBoard.