Short examples#

  1. Export a torch model into ONNX

Export a torch model into ONNX

import torch
from deeponnxcustom.tools.onnx_helper import save_as_onnx

class MyModel(torch.nn.Module):
    # ...

nn = MyModel()
save_as_onnx(nn, "my_model.onnx")

(original entry : onnx_helper.py:docstring of deeponnxcustom.tools.onnx_helper.save_as_onnx, line 13)