module onnxrt.ops_cpu._op
#
Short summary#
module mlprodict.onnxrt.ops_cpu._op
Shortcut to ops_cpu.
Classes#
class |
truncated documentation |
---|---|
Default value for parameters when the parameter is not set but the operator has a default behaviour for it. |
|
Ancestor to all operators in this subfolder. The runtime for every node can checked into ONNX unit tests. … |
|
Ancestor to all unary operators in this subfolder and which produces position of extremas (ArgMax, …). Checks … |
|
Ancestor to all binary operators in this subfolder. Checks that inputs type are the same. |
|
Ancestor to all binary operators in this subfolder comparing tensors. |
|
Ancestor to all binary operators in this subfolder. Checks that inputs type are the same. |
|
Implements the inplaces logic. numpy_fct is a binary numpy function which takes two matrices and has a argument … |
|
Ancestor to all binary operators in this subfolder. Checks that inputs type are the same. |
|
Automates some methods for custom operators defined outside mlprodict. |
|
Implements the reduce logic. It must have a parameter axes. |
|
Ancestor to all unary operators in this subfolder. Checks that inputs type are the same. |
|
Ancestor to all unary and numerical operators in this subfolder. Checks that inputs type are the same. |
|
Raised when a type of a variable is unexpected. |
Functions#
function |
truncated documentation |
---|---|
Properties#
property |
truncated documentation |
---|---|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
Returns the list of modified parameters. |
|
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
Returns the list of optional arguments. |
|
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
Returns the list of optional arguments. |
|
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
Returns all parameters in a dictionary. |
|
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
Returns the number of expected classes. |
Methods#
method |
truncated documentation |
---|---|
usual |
|
|
usual |
|
usual |
|
usual |
|
usual |
|
usual |
|
usual |
|
usual |
|
usual |
|
usual |
|
usual |
|
|
|
|
|
|
|
|
|
|
|
|
Finds a custom operator defined by this runtime. |
|
|
|
|
|
|
|
Should be overwritten. |
|
Returns the same shape by default. We assume the operator returns the biggest shapes as the operator could … |
|
|
Returns the same shape by default. We assume the operator returns the biggest shapes as the operator could … |
|
Returns the same shape by default. We assume the operator returns the biggest shapes as the operator could … |
|
Returns the same shape by default. We assume the operator returns the biggest shapes as the operator could … |
Returns the same for the labels and the probabilities. |
|
|
Should be overwritten. |
|
Returns the same shape by default. |
Returns the same shape by default. |
|
|
Returns the same shape by default. |
Should be overwritten. |
|
|
|
|
|
|
|
|
|
|
|
|
Should be overwritten. |
|
|
|
|
Should be overwritten. |
|
Returns the boolean type. |
|
|
Returns the boolean type. |
|
Returns the boolean type. |
Returns the type of the labels and the probabilities. |
|
|
Should be overwritten. |
|
Returns the same type by default. |
Returns the same type by default. |
|
|
Returns the same type by default. |
Should be overwritten. |
|
|
Should be overwritten. |
|
Should be overwritten. |
|
Should be overwritten. |
|
Should be overwritten. |
|
Should be overwritten. |
|
Should be overwritten. |
|
Should be overwritten. |
|
Should be overwritten. |
|
Should be overwritten. |
Calls method |
|
|
Calls method |
Calls method |
|
|
Calls method |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Tells the node that one input can be overwritten. |
|
|
Tells the node that one input can be overwritten. |
|
Tells the node that one input can be overwritten. |
|
Tells the node that one input can be overwritten. |
|
Tells the node that one input can be overwritten. |
|
Tells the node that one input can be overwritten. |
|
Tells the node that one input can be overwritten. |
|
Tells the node that one input can be overwritten. |
|
Tells the node that one input can be overwritten. |
|
Tells the node that one input can be overwritten. |
|
Tells the node that one input can be overwritten. |
Infer shapes of the outputs given the shapes of the inputs. It works the same way as method run. |
|
|
|
|
Infer shapes of the outputs given the shapes of the inputs. It works the same way as method run. |
|
Infer shapes of the outputs given the shapes of the inputs. It works the same way as method run. |
|
Infer shapes of the outputs given the shapes of the inputs. It works the same way as method run. |
|
Infer shapes of the outputs given the shapes of the inputs. It works the same way as method run. |
|
|
|
Infer shapes of the outputs given the shapes of the inputs. It works the same way as method run. |
|
|
|
|
Infer sizes required for computation. It works the same way as method run. |
|
|
Infer sizes required for computation. It works the same way as method run. |
|
Infer sizes required for computation. It works the same way as method run. |
|
Infer sizes required for computation. It works the same way as method run. |
|
Infer sizes required for computation. It works the same way as method run. |
|
Infer sizes required for computation. It works the same way as method run. |
|
Infer sizes required for computation. It works the same way as method run. |
|
Infer sizes required for computation. It works the same way as method run. |
|
Infer sizes required for computation. It works the same way as method run. |
|
Infer sizes required for computation. It works the same way as method run. |
|
Infer sizes required for computation. It works the same way as method run. |
Infer types of the outputs given the types of the inputs. It works the same way as method run. |
|
|
|
|
Infer types of the outputs given the types of the inputs. It works the same way as method run. |
|
Infer types of the outputs given the types of the inputs. It works the same way as method run. |
|
Infer types of the outputs given the types of the inputs. It works the same way as method run. |
|
Infer types of the outputs given the types of the inputs. It works the same way as method run. |
|
|
|
Infer types of the outputs given the types of the inputs. It works the same way as method run. |
|
|
|
|
Tells the runtime if this node needs the context (all the results produced so far) as it may silently access … |
|
|
Tells the runtime if this node needs the context (all the results produced so far) as it may silently access … |
|
Tells the runtime if this node needs the context (all the results produced so far) as it may silently access … |
|
Tells the runtime if this node needs the context (all the results produced so far) as it may silently access … |
|
Tells the runtime if this node needs the context (all the results produced so far) as it may silently access … |
|
Tells the runtime if this node needs the context (all the results produced so far) as it may silently access … |
|
Tells the runtime if this node needs the context (all the results produced so far) as it may silently access … |
|
Tells the runtime if this node needs the context (all the results produced so far) as it may silently access … |
|
Tells the runtime if this node needs the context (all the results produced so far) as it may silently access … |
|
Tells the runtime if this node needs the context (all the results produced so far) as it may silently access … |
|
Tells the runtime if this node needs the context (all the results produced so far) as it may silently access … |
Calls method |
|
Calls method |
|
Calls method |
|
|
Calls method |
Calls method |
|
|
Calls method |
Calls method |
|
|
Calls method |
|
Calls method |
Calls method |
|
Calls method |
|
Switches all initializers to |
|
|
Switches all initializers to |
|
Switches all initializers to |
|
Switches all initializers to |
|
Switches all initializers to |
|
Switches all initializers to |
|
Switches all initializers to |
|
Switches all initializers to |
|
Switches all initializers to |
|
Switches all initializers to |
|
Switches all initializers to |
Returns a python code equivalent to this operator. |
|
|
Returns a python code equivalent to this operator. |
|
Returns a python code equivalent to this operator. |
|
Returns a python code equivalent to this operator. |
|
Returns a python code equivalent to this operator. |
Returns a python code equivalent to this operator. |
|
|
Returns a python code equivalent to this operator. |
|
Returns a python code equivalent to this operator. |
|
Returns a python code equivalent to this operator. |
|
Returns a python code equivalent to this operator. |
|
Returns a python code equivalent to this operator. |
Documentation#
Shortcut to ops_cpu.
- class mlprodict.onnxrt.ops_cpu._op.DefaultNone#
Bases:
object
Default value for parameters when the parameter is not set but the operator has a default behaviour for it.
- class mlprodict.onnxrt.ops_cpu._op.OpRun(onnx_node, desc=None, expected_attributes=None, **options)#
Bases:
object
Ancestor to all operators in this subfolder. The runtime for every node can checked into ONNX unit tests.
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- __init__(onnx_node, desc=None, expected_attributes=None, **options)#
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- __str__()#
usual
- _find_custom_operator_schema(op_name)#
- _infer_shapes(*args, **kwargs)#
Should be overwritten.
- _infer_sizes(*args, **kwargs)#
Should be overwritten.
- _infer_types(*args, **kwargs)#
Should be overwritten.
- _run(*args, **kwargs)#
Should be overwritten.
- _to_python_numpy(inputs, numpy_name)#
- property args_default#
Returns the list of arguments as well as the list of parameters with the default values (close to the signature).
- property args_default_modified#
Returns the list of modified parameters.
- property args_mandatory#
Returns the list of optional arguments.
- property args_optional#
Returns the list of optional arguments.
- property atts_value#
Returns all parameters in a dictionary.
- enable_inplace_compute(index)#
Tells the node that one input can be overwritten.
- Parameters
index – input index
- infer_shapes(*args, **kwargs)#
Infer shapes of the outputs given the shapes of the inputs. It works the same way as method run.
- infer_sizes(*args, **kwargs)#
Infer sizes required for computation. It works the same way as method run.
- infer_types(*args, **kwargs)#
Infer types of the outputs given the types of the inputs. It works the same way as method run.
- need_context()#
Tells the runtime if this node needs the context (all the results produced so far) as it may silently access one of them (operator Loop). The default answer is False.
- run(*args, **kwargs)#
Calls method
_run
.
- switch_initializers_dtype(dtype_in=<class 'numpy.float32'>, dtype_out=<class 'numpy.float64'>)#
Switches all initializers to
numpy.float64
. If model is None, a simple cast is done.- Parameters
dtype_in – previous type
dtype_out – next type
- Returns
done operations
- to_python(inputs)#
Returns a python code equivalent to this operator.
- Parameters
inputs – inputs name
- Returns
imports, python code, both as strings
- class mlprodict.onnxrt.ops_cpu._op.OpRunArg(onnx_node, desc=None, expected_attributes=None, **options)#
Bases:
mlprodict.onnxrt.ops_cpu._op.OpRunUnary
Ancestor to all unary operators in this subfolder and which produces position of extremas (ArgMax, …). Checks that inputs type are the same. The class must have attributes axis, keepdim.
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- __init__(onnx_node, desc=None, expected_attributes=None, **options)#
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- _infer_shapes(x)#
Returns the same shape by default.
- _infer_types(x)#
Returns the same type by default.
- _run_no_checks_(x)#
- run(x)#
Calls method
_run
.
- class mlprodict.onnxrt.ops_cpu._op.OpRunBinary(onnx_node, desc=None, expected_attributes=None, **options)#
Bases:
mlprodict.onnxrt.ops_cpu._op.OpRun
Ancestor to all binary operators in this subfolder. Checks that inputs type are the same.
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- __init__(onnx_node, desc=None, expected_attributes=None, **options)#
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- _infer_shapes(x, y)#
Returns the same shape by default. We assume the operator returns the biggest shapes as the operator could be using broacasting.
- _infer_sizes(*args, **kwargs)#
Should be overwritten.
- _infer_types(x, y)#
Returns the boolean type.
- _run_no_checks_(x, y)#
Calls method
_run
.
- run(x, y)#
Calls method
_run
.
- class mlprodict.onnxrt.ops_cpu._op.OpRunBinaryComparison(onnx_node, desc=None, expected_attributes=None, **options)#
Bases:
mlprodict.onnxrt.ops_cpu._op.OpRunBinary
Ancestor to all binary operators in this subfolder comparing tensors.
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- __init__(onnx_node, desc=None, expected_attributes=None, **options)#
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- _infer_types(x, y)#
Returns the boolean type.
- class mlprodict.onnxrt.ops_cpu._op.OpRunBinaryNum(onnx_node, desc=None, expected_attributes=None, **options)#
Bases:
mlprodict.onnxrt.ops_cpu._op.OpRunBinary
Ancestor to all binary operators in this subfolder. Checks that inputs type are the same.
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- __init__(onnx_node, desc=None, expected_attributes=None, **options)#
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- _run_no_checks_(x, y)#
Calls method
_run
.
- run(x, y)#
Calls method
_run
.
- class mlprodict.onnxrt.ops_cpu._op.OpRunBinaryNumpy(numpy_fct, onnx_node, desc=None, expected_attributes=None, **options)#
Bases:
mlprodict.onnxrt.ops_cpu._op.OpRunBinaryNum
Implements the inplaces logic. numpy_fct is a binary numpy function which takes two matrices and has a argument out for inplace operations.
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- __init__(numpy_fct, onnx_node, desc=None, expected_attributes=None, **options)#
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- _run(a, b)#
Should be overwritten.
- to_python(inputs)#
Returns a python code equivalent to this operator.
- Parameters
inputs – inputs name
- Returns
imports, python code, both as strings
- class mlprodict.onnxrt.ops_cpu._op.OpRunClassifierProb(onnx_node, desc=None, expected_attributes=None, **options)#
Bases:
mlprodict.onnxrt.ops_cpu._op.OpRunUnary
Ancestor to all binary operators in this subfolder. Checks that inputs type are the same.
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- __init__(onnx_node, desc=None, expected_attributes=None, **options)#
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- _infer_shapes(x)#
Returns the same for the labels and the probabilities.
- _infer_types(x)#
Returns the type of the labels and the probabilities.
- _run_no_checks_(x)#
- property nb_classes#
Returns the number of expected classes.
- run(x)#
Calls method
_run
.
- class mlprodict.onnxrt.ops_cpu._op.OpRunCustom(onnx_node, desc=None, expected_attributes=None, **options)#
Bases:
mlprodict.onnxrt.ops_cpu._op.OpRun
Automates some methods for custom operators defined outside mlprodict.
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- class OpRunCustomSchema(cls)#
Bases:
mlprodict.onnxrt.ops_cpu._new_ops.OperatorSchema
Custom schema.
- __init__(cls)#
- __init__(onnx_node, desc=None, expected_attributes=None, **options)#
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- _find_custom_operator_schema(op_name)#
Finds a custom operator defined by this runtime.
- class mlprodict.onnxrt.ops_cpu._op.OpRunReduceNumpy(onnx_node, desc=None, expected_attributes=None, **options)#
Bases:
mlprodict.onnxrt.ops_cpu._op.OpRunUnaryNum
Implements the reduce logic. It must have a parameter axes.
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- class mlprodict.onnxrt.ops_cpu._op.OpRunUnary(onnx_node, desc=None, expected_attributes=None, **options)#
Bases:
mlprodict.onnxrt.ops_cpu._op.OpRun
Ancestor to all unary operators in this subfolder. Checks that inputs type are the same.
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- __init__(onnx_node, desc=None, expected_attributes=None, **options)#
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- _infer_shapes(x)#
Returns the same shape by default.
- _infer_sizes(*args, **kwargs)#
Should be overwritten.
- _infer_types(x)#
Returns the same type by default.
- infer_shapes(x)#
Infer shapes of the outputs given the shapes of the inputs. It works the same way as method run.
- infer_types(x)#
Infer types of the outputs given the types of the inputs. It works the same way as method run.
- run(x)#
Calls method
_run
.
- class mlprodict.onnxrt.ops_cpu._op.OpRunUnaryNum(onnx_node, desc=None, expected_attributes=None, **options)#
Bases:
mlprodict.onnxrt.ops_cpu._op.OpRunUnary
Ancestor to all unary and numerical operators in this subfolder. Checks that inputs type are the same.
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- __init__(onnx_node, desc=None, expected_attributes=None, **options)#
- Parameters
onnx_node – onnx node
desc – internal representation
expected_attributes – expected attributes for this node
options – runtime options
- _run_no_checks_(x)#
- run(x)#
Calls method
_run
.
- exception mlprodict.onnxrt.ops_cpu._op.RuntimeTypeError#
Bases:
RuntimeError
Raised when a type of a variable is unexpected.
- mlprodict.onnxrt.ops_cpu._op._build_schemas()#