Skip to content

Latest commit

 

History

History
924 lines (687 loc) · 27.9 KB

Operators-ml.md

File metadata and controls

924 lines (687 loc) · 27.9 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

Select a subset of the data X based on the indices provided Y.

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 index values to select as a int64 tensor

Outputs

Z : T
Selected output data as an array

Type Constraints

T : tensor(float), tensor(double), tensor(int64), tensor(int32), tensor(string)
allowed types.

Makes values 1 or 0 based on a single threshold.

Version

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

Attributes

threshold : float
Values greater than this are set to 1, else set 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)
allowed types.

Converts a map to a tensor. Map key must be int64 and the values will be ordered in ascending order based on this key. 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
what type of tensor to cast the input to, enum 'TO_FLOAT','TO_STRING','TO_INT64', default is 'TO_FLOAT'
map_form : string
whether to only output as many values as are in the input, or position the input based on using the key of the map as the index of the output (sparse), enum 'DENSE', 'SPARSE', default is 'DENSE'
max_map : int
if map_form packing is SPARSE, what is the total length of each output in N (max index value)

Inputs

X : T1
Data to be encoded

Outputs

Y : T2
encoded output data

Type Constraints

T1 : map(int64, string), map(int64, float)
allowed input types.
T2 : tensor(string), tensor(float), tensor(int64)
allowed output types.

Convert strings to int64s and vice versa. Takes in a map to use for the conversion. The index position in the strings and ints repeated inputs is used to do the mapping. Each instantiated operator converts either ints to strings or strings to ints. This behavior is triggered based on which default value is set. If the string default value is set, it will convert ints to strings. If the int default value is set, it will convert strings to ints.

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
ints part of the input map, must be same size and the strings
cats_strings : list of strings
strings part of the input map, must be same size and the ints
default_int64 : int
int value to use if the string is not in the map
default_string : string
string value to use if the int is not in the map

Inputs

X : T1
Input data

Outputs

Y : T2
Output data, if strings are input, then output is int64s, and vice versa.

Type Constraints

T1 : tensor(string), tensor(int64)
allowed types.
T2 : tensor(string), tensor(int64)
allowed types.

Uses an index mapping to convert a dictionary to an array. 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. The position of the insertion is determined by the position of the item's key in the index mapping. Any keys not present in the input dictionary, will be zero in the output array. Use either string_vocabulary or int64_vocabulary, not both. 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
The vocabulary vector
string_vocabulary : list of strings
The vocabulary vector

Inputs

X : T1
The input dictionary

Outputs

Y : T2
The tensor

Type Constraints

T1 : map(string, int64), map(int64, string), map(int64, float), map(int64, double), map(string, float), map(string, double)
allowed types.
T2 : tensor(int64), tensor(float), tensor(double), tensor(string)
allowed types.

Concatenates input features into one continuous output of floats. inputdimensions is the size of each input feature. Inputs will be written to the output in the order of the input arguments. If an input tensor is shorter than its matching input dimension the output will be padded with zeros. If an input tensor is longer than its matching input dimension, the additional input will be ignored. Input tensors must all be of the same type. Use Cast as needed.
Input tensors must all be of the same batch size.

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
ordered input tensors

Outputs

Y : tensor(float)
Output array, in same order as Input, as floats

Type Constraints

T1 : tensor(int32), tensor(int64), tensor(float), tensor(double)
Allowed input types

Replace imputs that equal replaceValue/s with imputeValue/s. All other inputs are copied to the output unchanged. This op is used to replace missing values where we know what a missing value looks like. Only one of imputed_value_floats or imputed_value_int64s should be used. The size can be 1 element, which will be reused, or the size of the feature set F in input N,F

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 to change to
imputed_value_int64s : list of ints
value to change to
replaced_value_float : float
value that needs replacing
replaced_value_int64 : int
value that needs replacing

Inputs

X : T
Data to be imputed

Outputs

Y : T
Imputed output data

Type Constraints

T : tensor(float), tensor(double), tensor(int64), tensor(int32)
allowed types.

Convert class label to their integral type and vice versa. In both cases the operator is instantiated with the list of class strings. The integral value of the string is the index position in the list.

Version

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

Attributes

classes_strings : list of strings
List of class label strings to be encoded as int64s
default_int64 : int
Default value if not in class list as int64
default_string : string
Default value if not in class list as string

Inputs

X : T1
Data to be encoded

Outputs

Y : T2
Encoded output data

Type Constraints

T1 : tensor(string), tensor(int64)
allowed types.
T2 : tensor(string), tensor(int64)
allowed types.

Linear classifier prediction (choose class)

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 int labels
classlabels_strings : list of strings
class labels if using string labels
coefficients : list of floats (required)
weights of the model(s)
intercepts : list of floats
weights of the intercepts (if used)
multi_class : int
whether to do OvR or multinomial (0=OvR and is default)
post_transform : string
enum NONE, SOFTMAX, LOGISTIC, SOFTMAX_ZERO, 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, for each example

Type Constraints

T1 : tensor(float), tensor(double), tensor(int64), tensor(int32)
allowed types.
T2 : tensor(string), tensor(int64)
allowed types.

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. Coefficients are of the same length as an n, and 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
enum NONE, SOFTMAX, LOGISTIC, SOFTMAX_ZERO, PROBIT
targets : int
total number of regression targets (default is 1)

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)
allowed types.

Normalize the input. There are three normalization modes, which have the corresponding formulas: Max .. math:: max(x_i) L1 .. math:: z = ||x||1 = \sum{i=1}^{n} |x_i| L2 .. math:: z = ||x||2 = \sqrt{\sum{i=1}^{n} x_i^2}

Version

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

Attributes

norm : string
enum 'MAX', 'L1', 'L2'

Inputs

X : T
Data to be encoded

Outputs

Y : tensor(float)
encoded output data

Type Constraints

T : tensor(float), tensor(double), tensor(int64), tensor(int32)
allowed types.

Replace the inputs with an array of ones and zeros, where the only one is the zero-based category that was passed in. The total category count will determine the length of the vector. 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 in X is of the same category set
  (meaning there is only one category count).

  If the input is a tensor of float, int32, or double, the data will be cast
  to int64s 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
cats_strings : list of strings
list of categories, strings
zeros : int
if true and category is not present, will return all zeros, if false and missing category, operator will return false. Default is true (1).

Inputs

X : T
Data to be encoded

Outputs

Y : tensor(float)
encoded output data

Type Constraints

T : tensor(string), tensor(int64), tensor(int32), tensor(float), tensor(double)
allowed types.

SVM classifier prediction

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 int labels
classlabels_strings : list of strings
class labels if using string labels
coefficients : list of floats
kernel_params : list of floats
Tensor of 3 elements containing gamma, coef0, degree in that order. Zero if unused for the kernel.
kernel_type : string
enum LINEAR, POLY, RBF, SIGMOID, defaults to linear
post_transform : string
post eval transform for score, enum NONE, SOFTMAX, LOGISTIC, SOFTMAX_ZERO, PROBIT
prob_a : list of floats
First set of probability coefficients
prob_b : list of floats
Second set of probability coefficients, must be same size as prob_a, if these are provided then output Z are probability estimates.
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)
allowed types.
T2 : tensor(string), tensor(int64)
allowed types.

SVM 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
Tensor of 3 elements containing gamma, coef0, degree in that order. Zero if unused for the kernel.
kernel_type : string
enum LINEAR, POLY, RBF, SIGMOID, defaults to linear
n_supports : int
number of support vectors
one_class : int
bool whether the regression is a one class svm or not, defaults to false
post_transform : string
post eval transform for score, enum NONE, SOFTMAX, LOGISTIC, SOFTMAX_ZERO, 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)
allowed types.

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, must be same length as scale
scale : list of floats
second, multiply by this, can be length of features or length 1

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)
allowed types.

Tree Ensemble classifier. Returns the top class 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 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. It is expected that either classlabels_strings or classlabels_int64s will be passed and the class_ids are an index into this list. 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

base_values : list of floats
base values for classification, added to final class score, size must be the same as classes or can be left unassigned (assumed 0)
class_ids : list of ints
index of the class list that this weight is for
class_nodeids : list of ints
node id that this weight is for
class_treeids : list of ints
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 int labels
classlabels_strings : list of strings
class labels if using string labels
nodes_falsenodeids : list of ints
child node if expression is false
nodes_featureids : list of ints
feature id for this node
nodes_hitrates : list of floats
nodes_missing_value_tracks_true : list of ints
for each node, decide if the value is missing (nan) then use true branch, this field can be left unset and will assume false for all nodes
nodes_modes : list of strings
enum of behavior for this node 'BRANCH_LEQ', 'BRANCH_LT', 'BRANCH_GTE', 'BRANCH_GT', 'BRANCH_EQ', 'BRANCH_NEQ', 'LEAF'
nodes_nodeids : list of ints
node id for this node, node ids may restart at zero for each tree (but not required).
nodes_treeids : list of ints
tree id for this node
nodes_truenodeids : list of ints
child node if expression is true
nodes_values : list of floats
thresholds to do the splitting on for this node.
post_transform : string
post eval transform for score, enum NONE, SOFTMAX, LOGISTIC, SOFTMAX_ZERO, PROBIT

Inputs

X : T1
Input N,F

Outputs

Y : T2
N, Top class for each point
Z : tensor(float)
N,E the class score for each class, for each point

Type Constraints

T1 : tensor(float), tensor(double), tensor(int64), tensor(int32)
allowed types.
T2 : tensor(string), tensor(int64)
allowed types.

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
enum, how to aggregate leaf values within a target, AVERAGE,SUM,MIN,MAX
base_values : list of floats
base values for regression, added to final score, size must be the same as n_outputs or can be left unassigned (assumed 0)
n_targets : int
total number of targets
nodes_falsenodeids : list of ints
child node if expression is false
nodes_featureids : list of ints
feature id for this node
nodes_hitrates : list of floats
popularity of the node, used for performance and may be omitted
nodes_missing_value_tracks_true : list of ints
for each node, decide if the value is missing (nan) then use true branch, this field can be left unset and will assume false for all nodes
nodes_modes : list of strings
enum of behavior for this node as enum of BRANCH_LEQ, BRANCH_LT, BRANCH_GTE, BRANCH_GT, BRANCH_EQ, BRANCH_NEQ, LEAF
nodes_nodeids : list of ints
node id for this node, node ids must restart at zero for each tree and increase sequentially.
nodes_treeids : list of ints
tree id for this node
nodes_truenodeids : list of ints
child node if expression is true
nodes_values : list of floats
thresholds to do the splitting on for this node.
post_transform : string
post eval transform for score, enum NONE, SOFTMAX, LOGISTIC, SOFTMAX_ZERO, PROBIT
target_ids : list of ints
index of the class list that this weight is for
target_nodeids : list of ints
node id that this weight is for
target_treeids : list of ints
tree that this node is in
target_weights : list of floats
the weight for the class in target_id

Inputs

X : T
Input N,F

Outputs

Y : tensor(float)
N classes

Type Constraints

T : tensor(float), tensor(double), tensor(int64), tensor(int32)
allowed types.

Makes a map from the input and the attributes. Assumes input 0 are the values, and the keys are specified by the attributes. Must provide keys in either classlabels_strings or classlabels_int64s (but not both). Input 0 may have a batch size larger than 1, but each input in the batch must be the size of the keys specified by the attributes. The order of the input and attributes determines the key-value mapping.

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
keys if using int keys
classlabels_strings : list of strings
keys if using string keys

Inputs

X : tensor(float)
The input values

Outputs

Z : T
The output map

Type Constraints

T : seq(map(string, float)), seq(map(int64, float))
allowed types.