There are two Python packages for ONNX Runtime. Only one of these packages should be installed at a time in any one environment. The GPU package encompasses most of the CPU functionality.
## Quickstart Examples for PyTorch, TensorFlow, and SciKit Learn
Train a model using your favorite framework, export to ONNX format and inference in any supported ONNX Runtime language!
### PyTorch CV
{: .no_toc }
In this example we will go over how to export a PyTorch CV model into ONNX format and then inference with ORT. The code to create the model is from the [PyTorch Fundamentals learning path on Microsoft Learn](https://aka.ms/learnpytorch).
- Export the model using `torch.onnx.export`
```python
torch.onnx.export(model, # model being run
torch.randn(1, 28, 28).to(device), # model input (or a tuple for multiple inputs)
"fashion_mnist_model.onnx", # where to save the model (can be a file or file-like object)
input_names = ['input'], # the model's input names
output_names = ['output']) # the model's output names
In this example we will go over how to export a PyTorch NLP model into ONNX format and then inference with ORT. The code to create the AG News model is from [this PyTorch tutorial](https://pytorch.org/tutorials/beginner/text_sentiment_ngrams_tutorial.html).
- Process text and create the sample data input and offsets for export.
```python
import torch
text = "Text from the news article"
text = torch.tensor(text_pipeline(text))
offsets = torch.tensor([0])
```
- Export Model
```python
# Export the model
torch.onnx.export(model, # model being run
(text, offsets), # model input (or a tuple for multiple inputs)
"ag_news_model.onnx", # where to save the model (can be a file or file-like object)
export_params=True, # store the trained parameter weights inside the model file
opset_version=10, # the ONNX version to export the model to
do_constant_folding=True, # whether to execute constant folding for optimization
input_names = ['input', 'offsets'], # the model's input names
output_names = ['output'], # the model's output names
print("This is a %s news" %ag_news_label[result[0]])
```
### TensorFlow CV
{: .no_toc }
In this example we will go over how to export a TensorFlow CV model into ONNX format and then inference with ORT. The model used is from this [GitHub Notebook for Keras resnet50](https://github.com/onnx/tensorflow-onnx/blob/master/tutorials/keras-resnet50.ipynb).
- Get the pretrained model
```python
import os
import tensorflow as tf
from tensorflow.keras.applications.resnet50 import ResNet50
In this example we will go over how to export a SciKit Learn CV model into ONNX format and then inference with ORT. We’ll use the famous iris datasets.
```python
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split