# Onnx Helper

class `systemds.onnx_systemds.onnx_helper.``NodeTree`(nodes: [<class 'onnx.onnx_ONNX_REL_1_7_ml_pb2.NodeProto'>])

  A simple class for representing a tree structure of nodes

  `remove_end_node`(node: systemds.onnx_systemds.onnx_helper.TreeNode)

    Removes the given end-node from the tree. Removing a non-existing or non end-node raises an exception. :param node: The node that shall be removed

class `systemds.onnx_systemds.onnx_helper.``PreparedValue`(value_info: onnx.onnx_ONNX_REL_1_7_ml_pb2.ValueInfoProto, initializer: onnx.onnx_ONNX_REL_1_7_ml_pb2.TensorProto = None)

  Class for preparing onnx value structures for writing them to the dml script

`systemds.onnx_systemds.onnx_helper.``get_graph_inputs_with_initializers`(graph: onnx.onnx_ONNX_REL_1_7_ml_pb2.GraphProto) → [(<class ‘onnx.onnx_ONNX_REL_1_7_ml_pb2.ValueInfoProto’>, <class ‘onnx.onnx_ONNX_REL_1_7_ml_pb2.TensorProto’>)]

  Returns all initialized inputs of the graph with their corresponding initializer.

  Parameters

    graph – the onnx-graph

  Returns

    list of tuples of (input, initializer)

`systemds.onnx_systemds.onnx_helper.``get_graph_inputs_without_initializers`(graph: onnx.onnx_ONNX_REL_1_7_ml_pb2.GraphProto) → [<class ‘onnx.onnx_ONNX_REL_1_7_ml_pb2.ValueInfoProto’>]

  Returns all inputs of the graph that have no associated initializer values.

  Parameters

    graph – the onnx-graph

  Returns

    list of uninitialized inputs

`systemds.onnx_systemds.onnx_helper.``get_value_info`(graph: onnx.onnx_ONNX_REL_1_7_ml_pb2.GraphProto, name: str) → onnx.onnx_ONNX_REL_1_7_ml_pb2.ValueInfoProto

  Searches the graph for the given name and returns the associated ValueInfo, if the name is not found None is returned.

  Parameters

    - graph – the onnx-graph that shall be searched

    - name – the name of the value

  Returns

    the value-info or None if it is not found

`systemds.onnx_systemds.onnx_helper.``load_model`(onnx_file: str) → onnx.onnx_ONNX_REL_1_7_ml_pb2.ModelProto

  Loads the onnx file, checks the model and converts it to a common version if necessary.

  Parameters

    onnx_file –

  Returns

    the loaded onnx-model