onnx_chainer.onnx_helper.GraphBuilder

class onnx_chainer.onnx_helper.GraphBuilder[source]

A helper class to build consecutive ONNX nodes.

Methods

node_name()[source]
nodes(output_names=None)[source]

Returns all nodes created so far.

Parameters:output_names (list of str) – The names of output values to be set at the last node.
Returns:A list of onnx.NodeProto objects, suitable as the return value of converter functions.
op(op_name, input_names, num_outputs=1, **kwargs)[source]

Creates a new ONNX node and returns its outputs.

Parameters:
  • op_name (str) – The name of an ONNX op.
  • input_names (list of str) – The names of input values.
  • num_outputs (int) – The number of output values.
  • **kwargs (dict) – ONNX attributes of the node.
Returns:

A str of the output name when num_outputs is 1. A tuple of str of the output names otherwise.

op_output_named(op_name, input_names, output_names, **kwargs)[source]

Creates a new ONNX node with output names, and returns its outputs.

Parameters:
  • op_name (str) – The name of an ONNX op.
  • input_names (list of str) – The names of input values.
  • output_names (int of str) – The names of output values.
  • **kwargs (dict) – ONNX attributes of the node.
Returns:

A str of the output name when number of output is 1. A tuple of str of the output names otherwise.