export

dragon.onnx.export(
  inputs,
  outputs,
  f,
  input_names=None,
  output_names=None,
  input_shapes=None,
  opset_version=None,
  verbose=False,
  enable_onnx_checker=True
)[source]

Export the recorded graph to an onnx model.

Enter into the record mode to export operators into an onnx model:

x = dragon.constant([1, 2, 3])
with dragon.onnx.record():
    y = x * x
dragon.onnx.export(inputs=[x], outputs=[y], f='model.onnx')
Parameters:
  • inputs (Union[Sequence, Dict]) – The model inputs.
  • outputs (Union[Sequence, Dict]) – The model outputs.
  • f (str) – The filename for exporting model.
  • input_names (Sequence[str], optional) – The name to the inputs.
  • output_names (Sequence[str], optional) – The name to the outputs.
  • input_shapes (Union[Sequence, Dict], optional) – The optional rewritten for input shapes.
  • opset_version (int, optional) – The version of operator set.
  • verbose (bool, optional, default=False) – Whether to print the debug string of graph.
  • enable_onnx_checker (bool, optional, default=True) – Whether to check if model is valid.