Permalink
Branch: master
Find file Copy path
954 lines (717 sloc) 35.1 KB

Operator Schemas

This file is automatically generated from the def files via this script. Do not modify directly and instead edit operator definitions.

ai.onnx.ml

ai.onnx.ml.ArrayFeatureExtractor

Select elements of the input tensor based on the indices passed.
The indices are applied to the last axes of the tensor.

Version

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

Inputs

X : T
Data to be selected
Y : tensor(int64)
The indices, based on 0 as the first index of any dimension.

Outputs

Z : T
Selected output data as an array

Type Constraints

T : tensor(float), tensor(double), tensor(int64), tensor(int32), tensor(string)
The input must be a tensor of a numeric type or string. The output will be of the same tensor type.

ai.onnx.ml.Binarizer

Maps the values of the input tensor to either 0 or 1, element-wise, based on the outcome of a comparison against a threshold value.

Version

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

Attributes

threshold : float (default is 0.0)
Values greater than this are mapped to 1, others to 0.

Inputs

X : T
Data to be binarized

Outputs

Y : T
Binarized output data

Type Constraints

T : tensor(float), tensor(double), tensor(int64), tensor(int32)
The input must be a tensor of a numeric type. The output will be of the same tensor type.

ai.onnx.ml.CastMap

Converts a map to a tensor.
The map key must be an int64 and the values will be ordered in ascending order based on this key.
The operator supports dense packing or sparse packing. If using sparse packing, the key cannot exceed the max_map-1 value.

Version

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

Attributes

cast_to : string (default is TO_FLOAT)
A string indicating the desired element type of the output tensor, one of 'TO_FLOAT', 'TO_STRING', 'TO_INT64'.
map_form : string (default is DENSE)
Indicates whether to only output as many values as are in the input (dense), or position the input based on using the key of the map as the index of the output (sparse).
One of 'DENSE', 'SPARSE'.
max_map : int (default is 1)
If the value of map_form is 'SPARSE,' this attribute indicates the total length of the output tensor.

Inputs

X : T1
The input map that is to be cast to a tensor

Outputs

Y : T2
A tensor representing the same data as the input map, ordered by their keys

Type Constraints

T1 : map(int64, string), map(int64, float)
The input must be an integer map to either string or float.
T2 : tensor(string), tensor(float), tensor(int64)
The output is a 1-D tensor of string, float, or integer.

ai.onnx.ml.CategoryMapper

Converts strings to integers and vice versa.
Two sequences of equal length are used to map between integers and strings, with strings and integers at the same index detailing the mapping.
Each operator converts either integers to strings or strings to integers, depending on which default value attribute is provided. Only one default value attribute should be defined.
If the string default value is set, it will convert integers to strings. If the int default value is set, it will convert strings to integers.

Version

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

Attributes

cats_int64s : list of ints
The integers of the map. This sequence must be the same length as the 'cats_strings' sequence.
cats_strings : list of strings
The strings of the map. This sequence must be the same length as the 'cats_int64s' sequence
default_int64 : int (default is -1)
An integer to use when an input string value is not found in the map.
One and only one of the 'default_*' attributes must be defined.
default_string : string (default is _Unused)
A string to use when an input integer value is not found in the map.
One and only one of the 'default_*' attributes must be defined.

Inputs

X : T1
Input data

Outputs

Y : T2
Output data. If strings are input, the output values are integers, and vice versa.

Type Constraints

T1 : tensor(string), tensor(int64)
The input must be a tensor of strings or integers, either [N,C] or [C].
T2 : tensor(string), tensor(int64)
The output is a tensor of strings or integers. Its shape will be the same as the input shape.

ai.onnx.ml.DictVectorizer

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].

Version

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

Attributes

int64_vocabulary : list of ints
An integer vocabulary array.
One and only one of the vocabularies must be defined.
string_vocabulary : list of strings
A string vocabulary array.
One and only one of the vocabularies must be defined.

Inputs

X : T1
A dictionary.

Outputs

Y : 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.

ai.onnx.ml.FeatureVectorizer

Concatenates input tensors into one continuous output.
All input shapes are 2-D and are concatenated along the second dimention. 1-D tensors are treated as [1,C]. Inputs are copied to the output maintaining the order of the input arguments.
All inputs must be integers or floats, while the output will be all floating point values.

Version

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

Attributes

inputdimensions : list of ints
The size of each input in the input list

Inputs (1 - ∞)

X (variadic) : T1
An ordered collection of tensors, all with the same element type.

Outputs

Y : tensor(float)
The output array, elements ordered as the inputs.

Type Constraints

T1 : tensor(int32), tensor(int64), tensor(float), tensor(double)
The input type must be a tensor of a numeric type.

ai.onnx.ml.Imputer

Replaces inputs that equal one value with another, leaving all other elements alone.
This operator is typically used to replace missing values in situations where they have a canonical representation, such as -1, 0, NaN, or some extreme value.
One and only one of imputed_value_floats or imputed_value_int64s should be defined -- floats if the input tensor holds floats, integers if the input tensor holds integers. The imputed values must all fit within the width of the tensor element type. One and only one of the replaced_value_float or replaced_value_int64 should be defined, which one depends on whether floats or integers are being processed.
The imputed_value attribute length can be 1 element, or it can have one element per input feature.
In other words, if the input tensor has the shape [*,F], then the length of the attribute array may be 1 or F. If it is 1, then it is broadcast along the last dimension and applied to each feature.

Version

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

Attributes

imputed_value_floats : list of floats
Value(s) to change to
imputed_value_int64s : list of ints
Value(s) to change to.
replaced_value_float : float (default is 0.0)
A value that needs replacing.
replaced_value_int64 : int (default is 0)
A value that needs replacing.

Inputs

X : T
Data to be processed.

Outputs

Y : T
Imputed output data

Type Constraints

T : tensor(float), tensor(double), tensor(int64), tensor(int32)
The input type must be a tensor of a numeric type, either [N,C] or [C]. The output type will be of the same tensor type and shape.

ai.onnx.ml.LabelEncoder

Maps each element in the input tensor to another value.
The mapping is determined by the two parallel attributes, 'keys_' and 'values_' attribute. The i-th value in the specified 'keys_' attribute would be mapped to the i-th value in the specified 'values_' attribute. It implies that input's element type and the element type of the specified 'keys_' should be identical while the output type is identical to the specified 'values_' attribute. If an input element can not be found in the specified 'keys_' attribute, the 'default_' that matches the specified 'values_' attribute may be used as its output value.
Let's consider an example which maps a string tensor to an integer tensor. Assume and 'keys_strings' is ["Amy", "Sally"], 'values_int64s' is [5, 6], and 'default_int64' is '-1'. The input ["Dori", "Amy", "Amy", "Sally", "Sally"] would be mapped to [-1, 5, 5, 6, 6].
Since this operator is an one-to-one mapping, its input and output shapes are the same. Notice that only one of 'keys_
'/'values_' can be set.
For key look-up, bit-wise comparison is used so even a float NaN can be mapped to a value in 'values_
' attribute.

Version

This version of the operator has been available since version 2 of the 'ai.onnx.ml' operator set.

Other versions of this operator: ai.onnx.ml.LabelEncoder-1

Attributes

default_float : float (default is -0.0)
A float.
default_int64 : int (default is -1)
An integer.
default_string : string (default is _Unused)
A string.
keys_floats : list of floats
A list of floats.
keys_int64s : list of ints
A list of ints.
keys_strings : list of strings
A list of strings. One and only one of 'keys_*'s should be set.
values_floats : list of floats
A list of floats.
values_int64s : list of ints
A list of ints.
values_strings : list of strings
A list of strings. One and only one of 'value_*'s should be set.

Inputs

X : T1
Input data. It can be either tensor or scalar.

Outputs

Y : T2
Output data.

Type Constraints

T1 : tensor(string), tensor(int64), tensor(float)
The input type is a tensor of any shape.
T2 : tensor(string), tensor(int64), tensor(float)
Output type is determined by the specified 'values_*' attribute.

ai.onnx.ml.LinearClassifier

Linear classifier

Version

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

Attributes

classlabels_ints : list of ints
Class labels when using integer labels. One and only one 'classlabels' attribute must be defined.
classlabels_strings : list of strings
Class labels when using string labels. One and only one 'classlabels' attribute must be defined.
coefficients : list of floats (required)
A collection of weights of the model(s).
intercepts : list of floats
A collection of intercepts.
multi_class : int (default is 0)
Indicates whether to do OvR or multinomial (0=OvR is the default).
post_transform : string (default is NONE)
Indicates the transform to apply to the scores vector.
One of 'NONE,' 'SOFTMAX,' 'LOGISTIC,' 'SOFTMAX_ZERO,' or 'PROBIT'

Inputs

X : T1
Data to be classified.

Outputs

Y : T2
Classification outputs (one class per example).
Z : tensor(float)
Classification scores ([N,E] - one score for each class and example

Type Constraints

T1 : tensor(float), tensor(double), tensor(int64), tensor(int32)
The input must be a tensor of a numeric type, and of of shape [N,C] or [C]. In the latter case, it will be treated as [1,C]
T2 : tensor(string), tensor(int64)
The output will be a tensor of strings or integers.

ai.onnx.ml.LinearRegressor

Generalized linear regression evaluation.
If targets is set to 1 (default) then univariate regression is performed.
If targets is set to M then M sets of coefficients must be passed in as a sequence and M results will be output for each input n in N.
The coefficients array is of length n, and the coefficients for each target are contiguous. Intercepts are optional but if provided must match the number of targets.

Version

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

Attributes

coefficients : list of floats
Weights of the model(s).
intercepts : list of floats
Weights of the intercepts, if used.
post_transform : string (default is NONE)
Indicates the transform to apply to the regression output vector.
One of 'NONE,' 'SOFTMAX,' 'LOGISTIC,' 'SOFTMAX_ZERO,' or 'PROBIT'
targets : int (default is 1)
The total number of regression targets, 1 if not defined.

Inputs

X : T
Data to be regressed.

Outputs

Y : tensor(float)
Regression outputs (one per target, per example).

Type Constraints

T : tensor(float), tensor(double), tensor(int64), tensor(int32)
The input must be a tensor of a numeric type.

ai.onnx.ml.Normalizer

Normalize the input. There are three normalization modes, which have the corresponding formulas, defined using element-wise infix operators '/' and '^' and tensor-wide functions 'max' and 'sum':

Max: Y = X / max(X)
L1: Y = X / sum(X)
L2: Y = sqrt(X^2 / sum(X^2)}
In all modes, if the divisor is zero, Y == X.
For batches, that is, [N,C] tensors, normalization is done along the C axis. In other words, each row of the batch is normalized independently.

Version

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

Attributes

norm : string (default is MAX)
One of 'MAX,' 'L1,' 'L2'

Inputs

X : T
Data to be encoded, a tensor of shape [N,C] or [C]

Outputs

Y : tensor(float)
Encoded output data

Type Constraints

T : tensor(float), tensor(double), tensor(int64), tensor(int32)
The input must be a tensor of a numeric type.

ai.onnx.ml.OneHotEncoder

Replace each input element with an array of ones and zeros, where a single one is placed at the index of the category that was passed in. The total category count will determine the size of the extra dimension of the output array Y.
For example, if we pass a tensor with a single value of 4, and a category count of 8, the output will be a tensor with [0,0,0,0,1,0,0,0].
This operator assumes every input feature is from the same set of categories.
If the input is a tensor of float, int32, or double, the data will be cast to integers and the cats_int64s category list will be used for the lookups.

Version

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

Attributes

cats_int64s : list of ints
List of categories, ints.
One and only one of the 'cats_*' attributes must be defined.
cats_strings : list of strings
List of categories, strings.
One and only one of the 'cats_*' attributes must be defined.
zeros : int (default is 1)
If true and category is not present, will return all zeros; if false and a category if not found, the operator will fail.

Inputs

X : T
Data to be encoded.

Outputs

Y : tensor(float)
Encoded output data, having one more dimension than X.

Type Constraints

T : tensor(string), tensor(int64), tensor(int32), tensor(float), tensor(double)
The input must be a tensor of a numeric type.

ai.onnx.ml.SVMClassifier

Support Vector Machine classifier

Version

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

Attributes

classlabels_ints : list of ints
Class labels if using integer labels.
One and only one of the 'classlabels_*' attributes must be defined.
classlabels_strings : list of strings
Class labels if using string labels.
One and only one of the 'classlabels_*' attributes must be defined.
coefficients : list of floats
kernel_params : list of floats
List of 3 elements containing gamma, coef0, and degree, in that order. Zero if unused for the kernel.
kernel_type : string (default is LINEAR)
The kernel type, one of 'LINEAR,' 'POLY,' 'RBF,' 'SIGMOID'.
post_transform : string (default is NONE)
Indicates the transform to apply to the score.
One of 'NONE,' 'SOFTMAX,' 'LOGISTIC,' 'SOFTMAX_ZERO,' or 'PROBIT'
prob_a : list of floats
First set of probability coefficients.
prob_b : list of floats
Second set of probability coefficients. This array must be same size as prob_a.
If these are provided then output Z are probability estimates, otherwise they are raw scores.
rho : list of floats
support_vectors : list of floats
vectors_per_class : list of ints

Inputs

X : T1
Data to be classified.

Outputs

Y : T2
Classification outputs (one class per example).
Z : tensor(float)
Class scores (one per class per example), if prob_a and prob_b are provided they are probabilities for each class, otherwise they are raw scores.

Type Constraints

T1 : tensor(float), tensor(double), tensor(int64), tensor(int32)
The input must be a tensor of a numeric type, either [C] or [N,C].
T2 : tensor(string), tensor(int64)
The output type will be a tensor of strings or integers, depending on which of the the classlabels_* attributes is used. Its size will match the bactch size of the input.

ai.onnx.ml.SVMRegressor

Support Vector Machine regression prediction and one-class SVM anomaly detection.

Version

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

Attributes

coefficients : list of floats
Support vector coefficients.
kernel_params : list of floats
List of 3 elements containing gamma, coef0, and degree, in that order. Zero if unused for the kernel.
kernel_type : string (default is LINEAR)
The kernel type, one of 'LINEAR,' 'POLY,' 'RBF,' 'SIGMOID'.
n_supports : int (default is 0)
The number of support vectors.
one_class : int (default is 0)
Flag indicating whether the regression is a one-class SVM or not.
post_transform : string (default is NONE)
Indicates the transform to apply to the score.
One of 'NONE,' 'SOFTMAX,' 'LOGISTIC,' 'SOFTMAX_ZERO,' or 'PROBIT.'
rho : list of floats
support_vectors : list of floats
Chosen support vectors

Inputs

X : T
Data to be regressed.

Outputs

Y : tensor(float)
Regression outputs (one score per target per example).

Type Constraints

T : tensor(float), tensor(double), tensor(int64), tensor(int32)
The input type must be a tensor of a numeric type, either [C] or [N,C].

ai.onnx.ml.Scaler

Rescale input data, for example to standardize features by removing the mean and scaling to unit variance.

Version

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

Attributes

offset : list of floats
First, offset by this.
Can be length of features in an [N,F] tensor or length 1, in which case it applies to all features, regardless of dimension count.
scale : list of floats
Second, multiply by this.
Can be length of features in an [N,F] tensor or length 1, in which case it applies to all features, regardless of dimension count.
Must be same length as 'offset'

Inputs

X : T
Data to be scaled.

Outputs

Y : tensor(float)
Scaled output data.

Type Constraints

T : tensor(float), tensor(double), tensor(int64), tensor(int32)
The input must be a tensor of a numeric type.

ai.onnx.ml.TreeEnsembleClassifier

Tree Ensemble classifier. Returns the top class for each of N inputs.
The attributes named 'nodes_X' form a sequence of tuples, associated by index into the sequences, which must all be of equal length. These tuples define the nodes.
Similarly, all fields prefixed with 'class_' are tuples of votes at the leaves. A leaf may have multiple votes, where each vote is weighted by the associated class_weights index.
One and only one of classlabels_strings or classlabels_int64s will be defined. The class_ids are indices into this list.

Version

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

Attributes

base_values : list of floats
Base values for classification, added to final class score; the size must be the same as the classes or can be left unassigned (assumed 0)
class_ids : list of ints
The index of the class list that each weight is for.
class_nodeids : list of ints
node id that this weight is for.
class_treeids : list of ints
The id of the tree that this node is in.
class_weights : list of floats
The weight for the class in class_id.
classlabels_int64s : list of ints
Class labels if using integer labels.
One and only one of the 'classlabels_*' attributes must be defined.
classlabels_strings : list of strings
Class labels if using string labels.
One and only one of the 'classlabels_*' attributes must be defined.
nodes_falsenodeids : list of ints
Child node if expression is false.
nodes_featureids : list of ints
Feature id for each node.
nodes_hitrates : list of floats
Popularity of each node, used for performance and may be omitted.
nodes_missing_value_tracks_true : list of ints
For each node, define what to do in the presence of a missing value: if a value is missing (NaN), use the 'true' or 'false' branch based on the value in this array.
This attribute may be left undefined, and the defalt value is false (0) for all nodes.
nodes_modes : list of strings
The node kind, that is, the comparison to make at the node. There is no comparison to make at a leaf node.
One of 'BRANCH_LEQ', 'BRANCH_LT', 'BRANCH_GTE', 'BRANCH_GT', 'BRANCH_EQ', 'BRANCH_NEQ', 'LEAF'
nodes_nodeids : list of ints
Node id for each node. Ids may restart at zero for each tree, but it not required to.
nodes_treeids : list of ints
Tree id for each node.
nodes_truenodeids : list of ints
Child node if expression is true.
nodes_values : list of floats
Thresholds to do the splitting on for each node.
post_transform : string (default is NONE)
Indicates the transform to apply to the score.
One of 'NONE,' 'SOFTMAX,' 'LOGISTIC,' 'SOFTMAX_ZERO,' or 'PROBIT.'

Inputs

X : T1
Input of shape [N,F]

Outputs

Y : T2
N, Top class for each point
Z : tensor(float)
The class score for each class, for each point, a tensor of shape [N,E].

Type Constraints

T1 : tensor(float), tensor(double), tensor(int64), tensor(int32)
The input type must be a tensor of a numeric type.
T2 : tensor(string), tensor(int64)
The output type will be a tensor of strings or integers, depending on which of the the classlabels_* attributes is used.

ai.onnx.ml.TreeEnsembleRegressor

Tree Ensemble regressor. Returns the regressed values for each input in N.
All args with nodes_ are fields of a tuple of tree nodes, and it is assumed they are the same length, and an index i will decode the tuple across these inputs. Each node id can appear only once for each tree id.
All fields prefixed with target_ are tuples of votes at the leaves.
A leaf may have multiple votes, where each vote is weighted by the associated target_weights index.
All trees must have their node ids start at 0 and increment by 1.
Mode enum is BRANCH_LEQ, BRANCH_LT, BRANCH_GTE, BRANCH_GT, BRANCH_EQ, BRANCH_NEQ, LEAF

Version

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

Attributes

aggregate_function : string (default is SUM)
Defines how to aggregate leaf values within a target.
One of 'AVERAGE,' 'SUM,' 'MIN,' 'MAX.'
base_values : list of floats
Base values for classification, added to final class score; the size must be the same as the classes or can be left unassigned (assumed 0)
n_targets : int
The total number of targets.
nodes_falsenodeids : list of ints
Child node if expression is false
nodes_featureids : list of ints
Feature id for each node.
nodes_hitrates : list of floats
Popularity of each node, used for performance and may be omitted.
nodes_missing_value_tracks_true : list of ints
For each node, define what to do in the presence of a NaN: use the 'true' (if the attribute value is 1) or 'false' (if the attribute value is 0) branch based on the value in this array.
This attribute may be left undefined and the defalt value is false (0) for all nodes.
nodes_modes : list of strings
The node kind, that is, the comparison to make at the node. There is no comparison to make at a leaf node.
One of 'BRANCH_LEQ', 'BRANCH_LT', 'BRANCH_GTE', 'BRANCH_GT', 'BRANCH_EQ', 'BRANCH_NEQ', 'LEAF'
nodes_nodeids : list of ints
Node id for each node. Node ids must restart at zero for each tree and increase sequentially.
nodes_treeids : list of ints
Tree id for each node.
nodes_truenodeids : list of ints
Child node if expression is true
nodes_values : list of floats
Thresholds to do the splitting on for each node.
post_transform : string (default is NONE)
Indicates the transform to apply to the score.
One of 'NONE,' 'SOFTMAX,' 'LOGISTIC,' 'SOFTMAX_ZERO,' or 'PROBIT'
target_ids : list of ints
The index of the target that each weight is for
target_nodeids : list of ints
The node id of each weight
target_treeids : list of ints
The id of the tree that each node is in.
target_weights : list of floats
The weight for each target

Inputs

X : T
Input of shape [N,F]

Outputs

Y : tensor(float)
N classes

Type Constraints

T : tensor(float), tensor(double), tensor(int64), tensor(int32)
The input type must be a tensor of a numeric type.

ai.onnx.ml.ZipMap

Creates a map from the input and the attributes.
The values are provided by the input tensor, while the keys are specified by the attributes. Must provide keys in either classlabels_strings or classlabels_int64s (but not both).
The columns of the tensor correspond one-by-one to the keys specified by the attributes. There must be as many columns as keys.

Version

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

Attributes

classlabels_int64s : list of ints
The keys when using int keys.
One and only one of the 'classlabels_*' attributes must be defined.
classlabels_strings : list of strings
The keys when using string keys.
One and only one of the 'classlabels_*' attributes must be defined.

Inputs

X : tensor(float)
The input values

Outputs

Z : T
The output map

Type Constraints

T : seq(map(string, float)), seq(map(int64, float))
The output will be a sequence of string or integer maps to float.