Improves documentation, show InferenceSession contructor attributes (#8494)

* include constructor parameters in the python documentation
* expose more classes into the documentation
This commit is contained in:
Xavier Dupré 2021-07-26 15:58:47 +02:00 committed by GitHub
parent 79097ef553
commit a9fc3c448c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 8 deletions

View file

@ -158,14 +158,15 @@ Load and run a model
The main class *InferenceSession* wraps these functionalities
in a single place.
.. autoclass:: onnxruntime.ModelMetadata
:members:
Main class
----------
.. autoclass:: onnxruntime.InferenceSession
:members:
:inherited-members:
.. autoclass:: onnxruntime.NodeArg
:members:
Options
-------
.. autoclass:: onnxruntime.RunOptions
:members:
@ -173,6 +174,36 @@ in a single place.
.. autoclass:: onnxruntime.SessionOptions
:members:
Data
----
.. autoclass:: onnxruntime.OrtValue
:members:
.. autoclass:: onnxruntime.SparseTensor
:members:
Devices
-------
.. autoclass:: onnxruntime.IOBinding
:members:
.. autoclass:: onnxruntime.OrtDevice
:members:
Internal classes
----------------
These classes cannot be instantiated by users but they are returned
by methods or functions of this libary.
.. autoclass:: onnxruntime.ModelMetadata
:members:
.. autoclass:: onnxruntime.NodeArg
:members:
Backend
=======

View file

@ -46,6 +46,7 @@ master_doc = 'index'
language = "en"
exclude_patterns = []
pygments_style = 'default'
autoclass_content = 'both'
# -- Options for HTML output -------------------------------------------------

View file

@ -20,6 +20,7 @@ extensions = ['sphinx.ext.autodoc',
]
templates_path = ['_templates']
exclude_patterns = []
autoclass_content = 'both'
# -- Options for HTML output -------------------------------------------------

View file

@ -205,7 +205,7 @@ class Session:
:param input_feed: dictionary ``{ input_name: input_ort_value }``
See ``OrtValue`` class how to create OrtValue from numpy array or SparseTensor
:param run_options: See :class:`onnxruntime.RunOptions`.
:return an array of OrtValues
:return: an array of OrtValues
::
sess.run([output_name], {input_name: x})
@ -669,7 +669,7 @@ class SparseTensor:
have a 1-D shape when it contains a linear index of non-zero values and its length must be equal to
that of the values. It can also be of 2-D shape, in which has it contains pairs of coordinates for
each of the nnz values and its length must be exactly twice of the values length.
:param ort_device - describes the backing memory owned by the supplied nummpy arrays. Only CPU memory is
:param ort_device: - describes the backing memory owned by the supplied nummpy arrays. Only CPU memory is
suppored for non-numeric data types.
For primitive types, the method will map values and coo_indices arrays into native memory and will use
@ -693,7 +693,7 @@ class SparseTensor:
Its length must be equal to that of the values.
:param outer_indices: contiguous 1-D numpy array(int64) that contains CSR outer indices for the tensor.
Its length must be equal to the number of rows + 1.
:param ort_device - describes the backing memory owned by the supplied nummpy arrays. Only CPU memory is
:param ort_device: - describes the backing memory owned by the supplied nummpy arrays. Only CPU memory is
suppored for non-numeric data types.
For primitive types, the method will map values and indices arrays into native memory and will use them as
@ -747,7 +747,7 @@ class SparseTensor:
def to_cuda(self, ort_device):
'''
Returns a copy of this instance on the specified cuda device
:param ort_device with name 'cuda' and valid gpu device id
:param ort_device: with name 'cuda' and valid gpu device id
The method will throw if:
- this instance contains strings
- this instance is already on GPU. Cross GPU copy is not supported