parameters: (graph, op, func)
docstring: Converts an op to a function def node and add it to `func`.
docstring_summary: Converts an op to a function def node and add it to `func`.
docstring_tokens: Converts an op to a function def node and add it to func .
function: def _add_op_node(graph, op, func):
    """Converts an op to a function def node and add it to `func`."""
    node = function_pb2.FunctionDef.Node()
    node.op = op.type
    # pylint: disable=protected-access
    if graph._is_function(op.type):
      op_def = graph._get_function(op.type).signature
    else:
      op_def = op_def_registry.get_registered_ops()[op.type]
    # pylint: enable=protected-access
    attrs = _get_node_def_attr(op)
    out_index = 0
    for arg_def in op_def.output_arg:
      if arg_def.number_attr:
        dtype = arg_def.type or attrs[arg_def.type_attr].type
        num = attrs[arg_def.number_attr].i
        node.ret.append(_add_output_array(op, out_index, out_index + num, dtype,
                                          func))
        out_index += num
      elif arg_def.type_list_attr:
        dtype_lst = attrs[arg_def.type_list_attr].list.type
        num = len(dtype_lst)
        node.ret.append(_add_output_list(op, out_index, out_index + num,
                                         dtype_lst, func))
        out_index += num
      else:
        node.ret.append(_make_argname_from_tensor_name(op.outputs[
            out_index].name))
        out_index += 1
    inp_index = 0
    for arg_def in op_def.input_arg:
      if arg_def.number_attr:
        dtype = arg_def.type or attrs[arg_def.type_attr].type
        num = attrs[arg_def.number_attr].i
        node.arg.append(_add_input_array(op, inp_index, inp_index + num, dtype,
                                         func))
        inp_index += num
      elif arg_def.type_list_attr:
        num = len(attrs[arg_def.type_list_attr].list.type)
        node.arg.extend([_make_argname_from_tensor_name(op.inputs[i].name)
                         for i in range(inp_index, inp_index + num)])
        inp_index += num
      else:
        node.arg.append(_make_argname_from_tensor_name(op.inputs[inp_index].name))
        inp_index += 1
    node.dep.extend([_make_argname_from_tensor_name(x.name)
                     for x in op.control_inputs])
    for k, v in _get_node_def_attr(op).items():
      node.attr[k].CopyFrom(v)
    func.node.extend([node])
function_tokens: def _add_op_node ( graph , op , func ) : node = function_pb2 . FunctionDef . Node ( ) node . op = op . type # pylint: disable=protected-access if graph . _is_function ( op . type ) : op_def = graph . _get_function ( op . type ) . signature else : op_def = op_def_registry . get_registered_ops ( ) [ op . type ] # pylint: enable=protected-access attrs = _get_node_def_attr ( op ) out_index = 0 for arg_def in op_def . output_arg : if arg_def . number_attr : dtype = arg_def . type or attrs [ arg_def . type_attr ] . type num = attrs [ arg_def . number_attr ] . i node . ret . append ( _add_output_array ( op , out_index , out_index + num , dtype , func ) ) out_index += num elif arg_def . type_list_attr : dtype_lst = attrs [ arg_def . type_list_attr ] . list . type num = len ( dtype_lst ) node . ret . append ( _add_output_list ( op , out_index , out_index + num , dtype_lst , func ) ) out_index += num else : node . ret . append ( _make_argname_from_tensor_name ( op . outputs [ out_index ] . name ) ) out_index += 1 inp_index = 0 for arg_def in op_def . input_arg : if arg_def . number_attr : dtype = arg_def . type or attrs [ arg_def . type_attr ] . type num = attrs [ arg_def . number_attr ] . i node . arg . append ( _add_input_array ( op , inp_index , inp_index + num , dtype , func ) ) inp_index += num elif arg_def . type_list_attr : num = len ( attrs [ arg_def . type_list_attr ] . list . type ) node . arg . extend ( [ _make_argname_from_tensor_name ( op . inputs [ i ] . name ) for i in range ( inp_index , inp_index + num ) ] ) inp_index += num else : node . arg . append ( _make_argname_from_tensor_name ( op . inputs [ inp_index ] . name ) ) inp_index += 1 node . dep . extend ( [ _make_argname_from_tensor_name ( x . name ) for x in op . control_inputs ] ) for k , v in _get_node_def_attr ( op ) . items ( ) : node . attr [ k ] . CopyFrom ( v ) func . node . extend ( [ node ] )