@classmethod
def from_onnx(cls, graph):
    """ Create a OnnxGraph object from ONNX GraphProto """
    graph_ = cls(graph)
    for idx, node in enumerate(graph_.node):
        if not node.name:
            node.name = '{}_{}'.format(node.op_type, idx)
        elif '/' in node.name:
            node.name = node.name.replace('/', '_')
    graph_.connect_nodes()
    for node in graph_.node:
        for input_ in node.input:
            if input_ in graph_.tensor_dict:
                node.tensors[input_] = graph_.tensor_dict[input_]
    return graph_
