Metadata-Version: 2.1
Name: onnxruntime
Version: 0.1.3
Summary: ONNX Runtime Runtime Python bindings
Home-page: UNKNOWN
Author: Microsoft Corporation
Author-email: onnx@microsoft.com
License: Microsoft Software License Terms
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Provides-Extra: backend
Requires-Dist: onnx (>=1.2.3); extra == 'backend'

ONNX Runtime (Preview)
======================

ONNX Runtime (Preview)
enables high-performance evaluation of trained machine learning (ML)
models while keeping resource usage low. 
Building on Microsoft's dedication to the 
`Open Neural Network Exchange (ONNX) <https://onnx.ai/>`_
community, it supports traditional ML models as well 
as Deep Learning algorithms in the
`ONNX-ML format <https://github.com/onnx/onnx/blob/master/docs/IR.md>`_.
Documentation is available at
`Python Bindings for ONNX Runtime <https://aka.ms/onnxruntime-python>`_.

Example
-------

The following example demonstrates an end-to-end example
in a very common scenario. A model is trained with *scikit-learn*
but it has to run very fast in a optimized environment.
The model is then converted into ONNX format and ONNX Runtime
replaces *scikit-learn* to compute the predictions.

::

    # Train a model.
    from sklearn.datasets import load_iris
    from sklearn.model_selection import train_test_split
    from sklearn.ensemble import RandomForest
    iris = load_iris()
    X, y = iris.data, iris.target
    X_train, X_test, y_train, y_test = train_test_split(X, y)
    clr = RandomForest()
    clr.fit(X_train, y_train)

    # Convert into ONNX format with onnxmltools
    from onnxmltools import convert_sklearn
    from onnxmltools.utils import save_model
    from onnxmltools.convert.common.data_types import FloatTensorType
    initial_type = [('float_input', FloatTensorType([1, 4]))]
    onx = convert_sklearn(clr, initial_types=initial_type)
    save_model(onx, "rf_iris.onnx")

    # Compute the prediction with ONNX Runtime
    import onnxruntime as rt
    import numpy
    sess = rt.InferenceSession("rf_iris.onnx")
    input_name = sess.get_inputs()[0].name
    label_name = sess.get_outputs()[0].name
    pred_onx = sess.run([label_name], {input_name: X_test.astype(numpy.float32)})[0]   


