module onnxrt.ops_cpu.op_dict_vectorizer#

Inheritance diagram of mlprodict.onnxrt.ops_cpu.op_dict_vectorizer

Short summary#

module mlprodict.onnxrt.ops_cpu.op_dict_vectorizer

Runtime operator.

source on GitHub

Classes#

class

truncated documentation

DictVectorizer

DictVectorizer (ai.onnx.ml) =========================== Uses an index mapping to convert a dictionary to an array. Given …

Properties#

property

truncated documentation

args_default

Returns the list of arguments as well as the list of parameters with the default values (close to the signature). …

args_default_modified

Returns the list of modified parameters.

args_mandatory

Returns the list of optional arguments.

args_optional

Returns the list of optional arguments.

atts_value

Returns all parameters in a dictionary.

Methods#

method

truncated documentation

__init__

_infer_shapes

_infer_types

_run

Documentation#

Runtime operator.

source on GitHub

class mlprodict.onnxrt.ops_cpu.op_dict_vectorizer.DictVectorizer(ai.onnx.ml)#

Bases: OpRun

Uses an index mapping to convert a dictionary to an array.

Given a dictionary, each key is looked up in the vocabulary attribute corresponding to the key type. The index into the vocabulary array at which the key is found is then used to index the output 1-D tensor ‘Y’ and insert into it the value found in the dictionary ‘X’.

The key type of the input map must correspond to the element type of the defined vocabulary attribute. Therefore, the output array will be equal in length to the index mapping vector parameter. All keys in the input dictionary must be present in the index mapping vector. For each item in the input dictionary, insert its value in the output array. Any keys not present in the input dictionary, will be zero in the output array.

For example: if the string_vocabulary parameter is set to ["a", "c", "b", "z"], then an input of {"a": 4, "c": 8} will produce an output of [4, 8, 0, 0].

Attributes

  • int64_vocabulary: An integer vocabulary array. One and only one of the vocabularies must be defined. default value cannot be automatically retrieved (INTS)

  • string_vocabulary: A string vocabulary array. One and only one of the vocabularies must be defined. default value cannot be automatically retrieved (STRINGS)

Inputs

  • X (heterogeneous)T1: A dictionary.

Outputs

  • Y (heterogeneous)T2: A 1-D tensor holding values from the input dictionary.

Type Constraints

  • T1 map(string, int64), map(int64, string), map(int64, float), map(int64, double), map(string, float), map(string, double): The input must be a map from strings or integers to either strings or a numeric type. The key and value types cannot be the same.

  • T2 tensor(int64), tensor(float), tensor(double), tensor(string): The output will be a tensor of the value type of the input map. It’s shape will be [1,C], where C is the length of the input dictionary.

Version

Onnx name: DictVectorizer

This version of the operator has been available since version 1 of domain ai.onnx.ml.

Runtime implementation: DictVectorizer

__init__(onnx_node, desc=None, **options)#
_infer_shapes(x)#

Should be overwritten.

source on GitHub

_infer_types(x)#

Should be overwritten.

source on GitHub

_run(x, attributes=None, verbose=0, fLOG=None)#

Should be overwritten.

source on GitHub