MCPcopy
hub / github.com/onnx/onnx / make_graph

Function make_graph

onnx/helper.py:201–241  ·  view source on GitHub ↗

Construct a GraphProto Args: nodes: list of NodeProto name (string): graph name inputs: list of ValueInfoProto outputs: list of ValueInfoProto initializer: list of TensorProto doc_string (string): graph documentation value_info: list of Va

(
    nodes: Sequence[NodeProto],
    name: str,
    inputs: Sequence[ValueInfoProto],
    outputs: Sequence[ValueInfoProto],
    initializer: Sequence[TensorProto] | None = None,
    doc_string: str | None = None,
    value_info: Sequence[ValueInfoProto] | None = None,
    sparse_initializer: Sequence[onnx.SparseTensorProto] | None = None,
)

Source from the content-addressed store, hash-verified

199
200
201def make_graph(
202 nodes: Sequence[NodeProto],
203 name: str,
204 inputs: Sequence[ValueInfoProto],
205 outputs: Sequence[ValueInfoProto],
206 initializer: Sequence[TensorProto] | None = None,
207 doc_string: str | None = None,
208 value_info: Sequence[ValueInfoProto] | None = None,
209 sparse_initializer: Sequence[onnx.SparseTensorProto] | None = None,
210) -> GraphProto:
211 """Construct a GraphProto
212
213 Args:
214 nodes: list of NodeProto
215 name (string): graph name
216 inputs: list of ValueInfoProto
217 outputs: list of ValueInfoProto
218 initializer: list of TensorProto
219 doc_string (string): graph documentation
220 value_info: list of ValueInfoProto
221 sparse_initializer: list of onnx.SparseTensorProto
222 Returns:
223 GraphProto
224 """
225 if initializer is None:
226 initializer = []
227 if sparse_initializer is None:
228 sparse_initializer = []
229 if value_info is None:
230 value_info = []
231 graph = GraphProto()
232 graph.node.extend(nodes)
233 graph.name = name
234 graph.input.extend(inputs)
235 graph.output.extend(outputs)
236 graph.initializer.extend(initializer)
237 graph.sparse_initializer.extend(sparse_initializer)
238 graph.value_info.extend(value_info)
239 if doc_string:
240 graph.doc_string = doc_string
241 return graph
242
243
244def make_opsetid(domain: str, version: int) -> OperatorSetIdProto:

Calls

no outgoing calls

Tested by 15

test_binarizerMethod · 0.72
test_scalerMethod · 0.72
test_normalizerMethod · 0.72
test_imputer_floatMethod · 0.72
test_imputer_float_2dMethod · 0.72
test_imputer_intMethod · 0.72
test_dict_vectorizerMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…