0

Is it possible to convert the PyTorch Model to ONNX without exporting and further use it as an ONNX object directly in the script.

1 Answers1

1

You can export to memory, something like this:

import io
f = io.BytesIO()
torch.onnx.export(model, sample_inputs, f, ...)
onnx_model = onnx.load_model_from_string(f.getvalue())
Sergii Dymchenko
  • 6,890
  • 1
  • 21
  • 46