Cross-Framework

Since SOL v0.4.2 you can cross execute SOL models. For this just use sol.optimize(..., framework='?'). I.e. you can load an ONNX Model and run it within PyTorch using:

import sol

# Run Model with Numpy
import numpy as np
np_model  = sol.optimize('mymodel.onnx', framework='numpy')
np_input  = np.random.rand(1, 3, 224, 224).astype(np.float32)
np_output = np_model(np_input)

# Run Model with PyTorch
import torch 
py_model = sol.optimize('mymodel.onnx', framework='pytorch')
py_model.eval()
py_input = torch.from_numpy(np_input)
with torch.no_grad():
	py_output = py_model(py_input)

# Run Model with TensorFlow
import tensorflow as tf
tf_model = sol.optimize('mymodel.onnx', framework='tensorflow')
tf_output = tf_model(np_input)

IMPORTANT! This feature is only available for the Python based frameworks.