module npy.onnx_numpy_annotation
#
Short summary#
module mlprodict.npy.onnx_numpy_annotation
numpy annotations.
Classes#
class |
truncated documentation |
---|---|
Ancestor to custom signature. |
|
Used to annotation ONNX numpy functions. |
|
Shortcut to simplify signature description. |
|
Shortcut to simplify signature description. |
|
Shortcut to simplify signature description. |
|
Shortcut to simplify signature description. |
Functions#
function |
truncated documentation |
---|---|
Extracts arguments and optional parameters of a function. |
Static Methods#
staticmethod |
truncated documentation |
---|---|
Overwrites this method. |
|
|
Nicknames such as floats, int, ints, all can be used to describe multiple inputs for a signature. … |
|
Nicknames such as floats, int, ints, all can be used to describe multiple inputs for a signature. … |
|
Nicknames such as floats, int, ints, all can be used to describe multiple inputs for a signature. … |
|
Nicknames such as floats, int, ints, all can be used to describe multiple inputs for a signature. … |
Nicknames such as floats, int, ints, all can be used to describe multiple inputs for a signature. … |
Methods#
method |
truncated documentation |
---|---|
constructor |
|
usual |
|
|
usual |
|
usual |
|
usual |
usual |
|
|
Tries to infer output types. |
|
Tries to infer output types. |
|
Tries to infer output types. |
|
Tries to infer output types. |
Tries to infer output types. |
|
|
Returns the list of inputs, outputs. |
|
Returns the list of inputs, outputs. |
|
Returns the list of inputs, outputs. |
|
Returns the list of inputs, outputs. |
Returns the list of inputs, outputs. |
|
|
Returns expected dimensions given the input dimensions. |
|
Returns expected dimensions given the input dimensions. |
|
Returns expected dimensions given the input dimensions. |
|
Returns expected dimensions given the input dimensions. |
Returns expected dimensions given the input dimensions. |
Documentation#
numpy annotations.
New in version 0.6.
- class mlprodict.npy.onnx_numpy_annotation.NDArray#
Bases:
ndarray
,Generic
[Shape
,DType
]Used to annotation ONNX numpy functions.
New in version 0.6.
- classmethod __class_getitem__(params)#
Overwrites this method.
- __orig_bases__ = (<class 'numpy.ndarray'>, typing.Generic[~Shape, ~DType])#
- __parameters__ = (~Shape, ~DType)#
- class mlprodict.npy.onnx_numpy_annotation.NDArraySameType(dtypes=None)#
Bases:
NDArrayType
Shortcut to simplify signature description.
- Parameters:
dtypes – input dtypes
New in version 0.6.
constructor
- __init__(dtypes=None)#
constructor
- __repr__()#
usual
- class mlprodict.npy.onnx_numpy_annotation.NDArraySameTypeSameShape(dtypes=None)#
Bases:
NDArraySameType
Shortcut to simplify signature description.
- Parameters:
dtypes – input dtypes
New in version 0.6.
constructor
- __init__(dtypes=None)#
constructor
- class mlprodict.npy.onnx_numpy_annotation.NDArrayType(dtypes=None, dtypes_out=None, n_optional=None, nvars=False)#
Bases:
_NDArrayAlias
Shortcut to simplify signature description.
- Parameters:
dtypes – input dtypes
dtypes_out – output dtypes
n_optional – number of optional parameters, 0 by default
nvars – True if the function allows an infinite number of inputs, this is incompatible with parameter n_optional.
New in version 0.6.
constructor
- __init__(dtypes=None, dtypes_out=None, n_optional=None, nvars=False)#
constructor
- class mlprodict.npy.onnx_numpy_annotation.NDArrayTypeSameShape(dtypes=None, dtypes_out=None, n_optional=None, nvars=False)#
Bases:
NDArrayType
Shortcut to simplify signature description.
- Parameters:
dtypes – input dtypes
dtypes_out – output dtypes
n_optional – number of optional parameters, 0 by default
nvars – True if the function allows an infinite number of inputs, this is incompatible with parameter n_optional.
New in version 0.6.
constructor
- __init__(dtypes=None, dtypes_out=None, n_optional=None, nvars=False)#
constructor
- class mlprodict.npy.onnx_numpy_annotation._NDArrayAlias(dtypes=None, dtypes_out=None, n_optional=None, nvars=False)#
Bases:
object
Ancestor to custom signature.
- Parameters:
dtypes – input dtypes
dtypes_out – output dtypes
n_optional – number of optional parameters, 0 by default
nvars – True if the function allows an infinite number of inputs, this is incompatible with parameter n_optional.
dtypes, dtypes_out by default are a tuple of tuple:
first dimension: type of every input
second dimension: list of types for one input
New in version 0.6.
constructor
- __init__(dtypes=None, dtypes_out=None, n_optional=None, nvars=False)#
constructor
- __repr__()#
usual
- _get_output_types(key)#
Tries to infer output types.
- static _process_type(dtypes, mapped_types, index)#
Nicknames such as floats, int, ints, all can be used to describe multiple inputs for a signature. This function intreprets that.
<<<
from mlprodict.npy.onnx_numpy_annotation import _NDArrayAlias for name in ['all', 'int', 'ints', 'floats', 'T']: print(name, _NDArrayAlias._process_type(name, {'T': 0}, 0))
>>>
all (<class 'numpy.float32'>, <class 'numpy.float64'>, <class 'numpy.int32'>, <class 'numpy.int64'>, <class 'numpy.uint32'>, <class 'numpy.uint64'>) int (<class 'numpy.int64'>,) ints (<class 'numpy.int32'>, <class 'numpy.int64'>) floats (<class 'numpy.float32'>, <class 'numpy.float64'>) T ('T',)
- get_inputs_outputs(args, kwargs, version)#
Returns the list of inputs, outputs.
- Parameters:
args – list of arguments
kwargs – list of optional arguments
version – required version
- Returns:
tuple(inputs, kwargs, outputs, optional), inputs and outputs are tuple, kwargs are the arguments, optional is the number of optional arguments
- shape_calculator(dims)#
Returns expected dimensions given the input dimensions.
- mlprodict.npy.onnx_numpy_annotation.get_args_kwargs(fct, n_optional)#
Extracts arguments and optional parameters of a function.
- Parameters:
fct – function
n_optional – number of arguments to consider as optional arguments and not parameters, this parameter skips the first n_optional paramerters
- Returns:
arguments, OrderedDict
Any optional argument ending with ‘_’ is ignored.