def enumerate_model_node_outputs(model, add_node=False):
    """
    Enumerates all the nodes of a model.

    :param model: ONNX graph
    :param add_node: if False, the function enumerates
        all output names from every node, otherwise, it
        enumerates tuple (output name, node)
    :return: enumerator
    """
    if not hasattr(model, 'graph'):
        raise TypeError('Parameter model is not an ONNX model but {}'.
            format(type(model)))
    for node in model.graph.node:
        for out in node.output:
            yield (out, node) if add_node else out
