module onnx_tools.exports.numpy_helper
#
Short summary#
module mlprodict.onnx_tools.exports.numpy_helper
Numpy helpers for the conversion from onnx to numpy.
Classes#
class |
truncated documentation |
---|---|
Converts an ONNX operators into numpy code. |
Functions#
function |
truncated documentation |
---|---|
Needed or operator ArgMax. |
|
Needed or operator ArgMin. |
|
Implementation of operator ArrayFeatureExtractor with numpy. |
|
Converts an ONNX operators into numpy code. |
|
Implements operator slice in numpy. |
Static Methods#
staticmethod |
truncated documentation |
---|---|
Methods#
method |
truncated documentation |
---|---|
Main method, returns the python code for a given operator. |
Documentation#
Numpy helpers for the conversion from onnx to numpy.
- class mlprodict.onnx_tools.exports.numpy_helper.NumpyCode(opset, name=None, op_type=None, domain='', inputs=None, outputs=None, attributes=None, used=None, context=None, mark_inits=None, indent='', **unused)#
Bases:
object
Converts an ONNX operators into numpy code.
- Parameters:
opset – target opset for the conversion (usually unused)
name – node name
op_type – operator type
domain – domain
inputs – inputs
outputs – outputs
attributes – attributes
used – dictionary {k: v}, list of nodes taking k as input
context – whole context
mark_inits – marks initializer as replaced
indent – indentation of the second line and following
- Returns:
code as str
- __init__(opset, name=None, op_type=None, domain='', inputs=None, outputs=None, attributes=None, used=None, context=None, mark_inits=None, indent='', **unused)#
- _getat(name, defval=None, format=None)#
- _make_numpy_code_onnx()#
- _make_numpy_code_onnxml()#
- _make_numpy_code_others()#
- _make_sure_inputs(n, m=None)#
- _make_sure_opsets(mi, ma=None)#
- static _make_tuple(val)#
- _simplify(name, kind)#
- make_numpy_code()#
Main method, returns the python code for a given operator.
- mlprodict.onnx_tools.exports.numpy_helper.argmax_use_numpy_select_last_index(data, axis=0, keepdims=True, select_last_index=False)#
Needed or operator ArgMax.
- mlprodict.onnx_tools.exports.numpy_helper.argmin_use_numpy_select_last_index(data, axis=0, keepdims=True, select_last_index=False)#
Needed or operator ArgMin.
- mlprodict.onnx_tools.exports.numpy_helper.array_feature_extrator(data, indices)#
Implementation of operator ArrayFeatureExtractor with numpy.
- mlprodict.onnx_tools.exports.numpy_helper.make_numpy_code(opset, name=None, op_type=None, domain='', inputs=None, outputs=None, attributes=None, used=None, context=None, mark_inits=None, indent='', **unused)#
Converts an ONNX operators into numpy code.
- Parameters:
opset – target opset for the conversion (usually unused)
name – node name
op_type – operator type
domain – domain
inputs – inputs
outputs – outputs
attributes – attributes
used – dictionary {k: v}, list of nodes taking k as input
context – whole context
mark_inits – marks initializer as replaced
indent – indentation of the second line and following
- Returns:
code as str
- mlprodict.onnx_tools.exports.numpy_helper.make_slice(data, starts, ends, axes=None, steps=None)#
Implements operator slice in numpy.
- Parameters:
data – input
starts – mandatory
ends – mandatory
axes – optional
steps – optional
- Returns:
results