include_traditionalml_kernels.h#
-
namespace onnx_light#
Alias that makes onnx-light headers compatible with code that references
ONNX_LIGHT_NAMESPACE(the macro used in the standard onnx package).Set to
ONNX_LIGHT_NAMESPACEso both names resolve to the same namespace.Symbol-visibility attribute for the public onnx-light C++ API.
Defined as empty because onnx-light does not require explicit
__declspec(dllexport)or__attribute__((visibility("default")))annotations — visibility is controlled at the shared-library level. The macro is provided so that vendored ONNX headers that decorate their declarations withONNX_APIcompile without modification.Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal
onnxnamespace — rather than theONNX_NAMESPACEmacro — resolves to the onnx-light namespace. The standard onnx package lives innamespace onnx; onnx-light usesonnx_light(via ONNX_LIGHT_NAMESPACE), so this alias keeps onnx-light a true drop-in. It is only introduced when the onnx-light namespace differs fromonnx.-
namespace onnx_kernels#
-
namespace kernel#
-
class ArrayFeatureExtractor : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation of the
ai.onnx.mlArrayFeatureExtractoroperator (since opset 1 in theai.onnx.mldomain).For each logical “row” in the input tensor (all dimensions except the last one), this kernel gathers values from the last axis according to
indices(inputY). The output type matches the input type. The output shape is the input shape with the last dimension replaced bynumel(indices).Public Functions
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
inline explicit KernelBase(const KernelContext &ctx)#
-
class Binarizer : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation of the
ai.onnx.mlBinarizeroperator (since opset 1 in theai.onnx.mldomain).For every input element
x[i], the output elementy[i]is1ifx[i] > thresholdand0otherwise. The output tensor has the same shape and element type as the input.The kernel supports the four numeric element types listed in the ONNX schema via explicit template instantiations:
floatdoubleint64_tint32_t
The in-place overload throws
std::invalid_argumentif the preallocated output’s dtype/shape/byte size do not match the input’s.Public Functions
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
class CastMap : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation of the
ai.onnx.mlCastMapoperator (since opset 1 in theai.onnx.mldomain).Converts a map
input_keys/input_values(key typeint64_t, value typestd::stringorfloat) into a 1-D output tensor. The packing of the output is controlled bymap_form:"DENSE"— the output has lengthinput_keys.size(); entries are written in ascending order of their input keys."SPARSE"— the output has lengthmax_map; entries are written at positionkeyfor every key in the input map and the remaining positions are zero (or empty string for string outputs).
The output element type is determined by
cast_to:"TO_FLOAT"→floatoutput (string values are parsed, float values are forwarded);"TO_INT64"→int64_toutput (string values are parsed, float values are truncated);"TO_STRING"→std::stringoutput (float values are formatted usingstd::to_string, string values are forwarded).
input_keys.size()must matchinput_values.size(). The kernel throwsstd::invalid_argumentfor unsupported attribute values, whenmap_form == "SPARSE"and a key is< 0or>= max_map, or when the in-place output’s dtype/shape do not match the expected output.Public Functions
-
template<typename V, typename OutT>
Tensor operator()(const std::vector<int64_t> &input_keys, const std::vector<V> &input_values, const std::string &cast_to, const std::string &map_form, int64_t max_map) const#
-
template<typename V, typename OutT>
void operator()(const std::vector<int64_t> &input_keys, const std::vector<V> &input_values, const std::string &cast_to, const std::string &map_form, int64_t max_map, Tensor &output) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
class CategoryMapper : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation of the
ai.onnx.mlCategoryMapperoperator (since opset 1 in theai.onnx.mldomain).Converts strings to integers (or vice versa) using two parallel lookup arrays
cats_stringsandcats_int64sof identical length. When the input element type isstd::string, the kernel emits anint64tensor whose element at positioniiscats_int64s[k]wherekis the index of the first matchingcats_strings[k] == x[i](anddefault_int64when no key matches). When the input element type isint64_t, the kernel emits astd::stringtensor whose element at positioniiscats_strings[k]wherekis the index of the first matchingcats_int64s[k] == x[i](anddefault_stringwhen no key matches).The output tensor has the same shape as the input tensor. The kernel supports the two element-type combinations listed in the ONNX schema via explicit template instantiations:
std::stringinput →int64_toutputint64_tinput →std::stringoutput
The in-place overload throws
std::invalid_argumentif the preallocated output’s dtype/shape/byte size do not match the expected output.Public Functions
-
template<typename InT, typename OutT>
Tensor operator()(const Tensor &x, const std::vector<std::string> &cats_strings, const std::vector<int64_t> &cats_int64s, OutT default_value) const#
-
template<typename InT, typename OutT>
void operator()(const Tensor &x, const std::vector<std::string> &cats_strings, const std::vector<int64_t> &cats_int64s, OutT default_value, Tensor &output) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
class DictVectorizer : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation of the
ai.onnx.mlDictVectorizeroperator (since opset 1 in theai.onnx.mldomain).Converts a dictionary, represented here as parallel
keys/valuesarrays, into a 1-D output tensor of shape[len(vocabulary)]. For every key in the input dictionary, the kernel looks up the key’s index in the supplied vocabulary and writes the corresponding value into that slot. Keys missing from the input dictionary leave a0(or empty string) at their vocabulary index in the output.Two helper template parameters control the variant:
K— element type of the dictionary keys (int64_torstd::string);V— element type of the dictionary values (int64_t,float,doubleorstd::string).
All keys in
input_keysmust be present invocabulary; the kernel throwsstd::invalid_argumentotherwise.input_keysandinput_valuesmust have the same length.Public Functions
-
template<typename K, typename V>
Tensor operator()(const std::vector<K> &input_keys, const std::vector<V> &input_values, const std::vector<K> &vocabulary) const#
-
template<typename K, typename V>
void operator()(const std::vector<K> &input_keys, const std::vector<V> &input_values, const std::vector<K> &vocabulary, Tensor &output) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
class FeatureVectorizer : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation of the
ai.onnx.mlFeatureVectorizeroperator (since opset 1 in theai.onnx.mldomain).Concatenates a variadic list of 1-D or 2-D input tensors along the second (feature) dimension, casting every value to
float. 1-D inputs are treated as[1, C]. When theinputdimensionsattribute is provided each input is truncated or zero-padded to its declared feature width before concatenation. The output element type is alwaysfloatand the output shape is[N, sum(input_dims)]whereNis the common batch size of the inputs (taken as the maximum reported batch size; smaller inputs are broadcast to row 0).The kernel supports the four numeric input element types listed in the ONNX schema via explicit template instantiations:
floatdoubleint64_tint32_t
Each input may use any of the four supported element types — they need not agree across inputs. The kernel validates each input’s dtype against the caller-supplied per-input template parameters; the convenience overload that takes a homogeneous
std::vector<Tensor>plus the per-input element typeDataTypedispatches to the right template specialization.Public Functions
-
Tensor operator()(const std::vector<Tensor> &inputs, const std::vector<int64_t> &inputdimensions) const#
Concatenates the input tensors (each cast to
float) along the trailing feature dimension.inputdimensions, when non-empty, must have the same length asinputsand gives the declared feature width per input. When empty the feature width is taken from each input’s last dimension.
-
void operator()(const std::vector<Tensor> &inputs, const std::vector<int64_t> &inputdimensions, Tensor &output) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
class Imputer : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation of the
ai.onnx.mlImputeroperator (since opset 1 in theai.onnx.mldomain).Replaces each element
x[i]that matches thereplaced_valuewith the correspondingimputed_value[i % stride], wherestrideis the length of theimputed_valuevector (either 1 for broadcast or equal to the size of the last dimension ofx). Elements that do not match are left unchanged. For float/double inputs, NaN equality is used forreplaced_value_floatwhen the replaced value is NaN.The kernel supports the four numeric element types listed in the ONNX schema via explicit template instantiations:
floatdoubleint64_tint32_t
The in-place overload throws
std::invalid_argumentif the preallocated output’s dtype/shape/byte size do not match the input’s.Public Functions
-
template<typename T>
Tensor operator()(const Tensor &x, const std::vector<T> &imputed_values, T replaced_value) const#
-
template<typename T>
void operator()(const Tensor &x, const std::vector<T> &imputed_values, T replaced_value, Tensor &output) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
class LabelEncoder : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Maps each element of the input tensor through a pair of parallel
keys/valuesarrays — the reference behaviour of theai.onnx.mlLabelEncoderoperator (since opset 4 in theai.onnx.mldomain).For every input element
x[i], the output elementy[i]isvalues[k]wherekis the index of the firstkeys[k]that matchesx[i]; if no key matches,y[i]isdefault_value.The output tensor has the same shape as the input tensor. The kernel supports the following
(KeyT, ValueT)element-type combinations via explicit template instantiations:(int64_t, int64_t)(int64_t, float)(float, int64_t)(float, float)(std::string, int64_t)(std::string, int16_t)
keys.size()must matchvalues.size(). The kernel throwsstd::invalid_argumentif the input element type does not matchKeyTor, for the in-place overload, if the preallocated output’s type/shape do not match the resolved value type and the input shape.Public Functions
-
template<typename KeyT, typename ValueT>
Tensor operator()(const Tensor &x, const std::vector<KeyT> &keys, const std::vector<ValueT> &values, ValueT default_value) const#
-
template<typename KeyT, typename ValueT>
void operator()(const Tensor &x, const std::vector<KeyT> &keys, const std::vector<ValueT> &values, ValueT default_value, Tensor &output) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
class LinearClassifier : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation helper for the
ai.onnx.mlLinearClassifieroperator (since opset 1).Computes raw scores
Z = X @ W^T + bwhereWhas shape[E, C](coefficientsis a flatE*Carray, classes contiguous) andbhas shape[E](intercepts). The predicted labelYis selected fromclass_labelsbased on the argmax ofZ(or the sign ofZfor binary classifiers with a single intercept and two labels, in which caseZis expanded to[N, 2]with the canonical[-z, z]convention).Public Functions
-
template<typename T>
std::pair<Tensor, Tensor> operator()(const Tensor &x, const std::vector<float> &coefficients, const std::vector<float> &intercepts, const std::vector<int64_t> &class_labels, const std::string &post_transform) const#
-
template<typename T>
std::pair<Tensor, Tensor> operator()(const Tensor &x, const std::vector<float> &coefficients, const std::vector<float> &intercepts, const std::vector<std::string> &class_labels, const std::string &post_transform) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
template<typename T>
-
class LinearRegressor : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation helper for the
ai.onnx.mlLinearRegressoroperator (since opset 1).Computes
Y = X @ W^T + bwhereWhas shape[targets, C]andbhas shape[targets](or is empty, in which case zeros are assumed). Onlypost_transform == "NONE"is supported.Public Functions
-
template<typename T>
Tensor operator()(const Tensor &x, const std::vector<float> &coefficients, const std::vector<float> &intercepts, int64_t targets, const std::string &post_transform) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
template<typename T>
-
class Normalizer : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation of the
ai.onnx.mlNormalizeroperator (since opset 1 in theai.onnx.mldomain).Normalizes the input
Xalong its last (feature) axis using one of three modes selected by thenormattribute:"MAX"—y = x / max(abs(x))per row."L1"—y = x / sum(abs(x))per row."L2"—y = x / sqrt(sum(x^2))per row.
If the per-row divisor is zero, the row is copied through unchanged (
y == x). The input may be[C](a single row) or[N, C](a batch of rows normalized independently).The output is always
floatwith the same shape as the input. The kernel supports the four numeric input element types listed in the ONNX schema via explicit template instantiations:floatdoubleint64_tint32_t
The in-place overload throws
std::invalid_argumentif the preallocated output’s dtype/shape/byte size do not match the expected float output.Public Functions
-
template<typename T>
void operator()(const Tensor &x, const std::string &norm, Tensor &output) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
class OneHotEncoder : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation of the
ai.onnx.mlOneHotEncoderoperator (since opset 1 in theai.onnx.mldomain).For every input element
x[i], the operator emits a one-hot row of lengthcats.size(): positionkis1.0whencats[k] == x[i]and0.0everywhere else. Ifx[i]matches no category andzerosistrue, the entire row is zero; ifzerosisfalsethe kernel throwsstd::invalid_argument.The output is always
floatwith shape equal to the input shape with an additional trailing dimension of sizecats.size(). The kernel supports the following category/element types via explicit template instantiations:int64_tcategories withint64_t,int32_t,floatordoubleinput element types (numeric inputs are cast toint64_tper the ONNX schema).std::stringcategories with astd::stringinput element type.
The in-place overload throws
std::invalid_argumentif the preallocated output’s dtype/shape/byte size do not match the expected one-hot output.Public Functions
-
template<typename T>
Tensor operator()(const Tensor &x, const std::vector<int64_t> &cats, bool zeros) const#
-
template<typename T>
void operator()(const Tensor &x, const std::vector<int64_t> &cats, bool zeros, Tensor &output) const#
-
void operator()(const Tensor &x, const std::vector<std::string> &cats, bool zeros, Tensor &output) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
class Scaler : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation of the
ai.onnx.mlScaleroperator (since opset 1 in theai.onnx.mldomain).For every input element
x[i], the output elementy[i]is(static_cast<float>(x[i]) - offset_k) * scale_kwherekisi % strideandstrideis the length of theoffset/scalevectors.offsetandscalemust have the same length, which must either be1(broadcast to every element) or equal to the size of the last dimension ofx.The output is always
floatwith the same shape as the input. The kernel supports the four numeric input element types listed in the ONNX schema via explicit template instantiations:floatdoubleint64_tint32_t
The in-place overload throws
std::invalid_argumentif the preallocated output’s dtype/shape/byte size do not match the expected float output.Public Functions
-
template<typename T>
Tensor operator()(const Tensor &x, const std::vector<float> &offset, const std::vector<float> &scale) const#
-
template<typename T>
void operator()(const Tensor &x, const std::vector<float> &offset, const std::vector<float> &scale, Tensor &output) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
class SVMClassifier : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation helper for the
ai.onnx.mlSVMClassifieroperator (since opset 1).This implementation supports the common binary-classification path and outputs:
Y: class labels (int64 or string)Z: one raw decision score per sample
Public Functions
-
template<typename T>
std::pair<Tensor, Tensor> operator()(const Tensor &x, const std::vector<float> &support_vectors, const std::vector<float> &coefficients, const std::vector<float> &rho, const std::vector<int64_t> &vectors_per_class, const std::vector<int64_t> &class_labels, const char *kernel_type, float gamma, float coef0, float degree) const#
-
template<typename T>
std::pair<Tensor, Tensor> operator()(const Tensor &x, const std::vector<float> &support_vectors, const std::vector<float> &coefficients, const std::vector<float> &rho, const std::vector<int64_t> &vectors_per_class, const std::vector<std::string> &class_labels, const char *kernel_type, float gamma, float coef0, float degree) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
class SVMRegressor : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation helper for the
ai.onnx.mlSVMRegressoroperator (since opset 1).Public Functions
-
template<typename T>
Tensor operator()(const Tensor &x, const std::vector<float> &support_vectors, const std::vector<float> &coefficients, const std::vector<float> &rho, const char *kernel_type, float gamma, float coef0, float degree) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
template<typename T>
-
class TreeEnsemble : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation helper for the
ai.onnx.mlTreeEnsembleoperator (opset 5 in theai.onnx.mldomain).Uses the new
TreeEnsembleencoding:tree_roots,nodes_splits(a tensor),leaf_targetids, andleaf_weights.Only
post_transform0 (NONE) and 1 (SOFTMAX) are supported.Public Functions
-
template<typename T>
Tensor operator()(const Tensor &x, const std::vector<int64_t> &tree_roots, const std::vector<int64_t> &nodes_featureids, const std::vector<T> &nodes_splits, const std::vector<uint8_t> &nodes_modes, const std::vector<int64_t> &nodes_truenodeids, const std::vector<int64_t> &nodes_falsenodeids, const std::vector<int64_t> &nodes_trueleafs, const std::vector<int64_t> &nodes_falseleafs, const std::vector<int64_t> &nodes_missing, const std::vector<int64_t> &leaf_targetids, const std::vector<T> &leaf_weights, const std::vector<T> &membership_values, int64_t n_targets, int64_t aggregate_function, int64_t post_transform) const# - Parameters:
x – Input feature matrix
[N, F].tree_roots – Index into nodes_* arrays for each tree root.
nodes_featureids – Feature index per interior node.
nodes_splits – Threshold per interior node (same type as x).
nodes_modes – Comparison mode per node (uint8 encoding).
nodes_truenodeids – True-branch index per node.
nodes_falsenodeids – False-branch index per node.
nodes_trueleafs – 1 if true branch is a leaf.
nodes_falseleafs – 1 if false branch is a leaf.
nodes_missing – 1 if NaN follows true branch.
leaf_targetids – Target index per leaf.
leaf_weights – Weight per leaf (same type as x).
membership_values – Flat list of set-member values consumed in
nodes_modesorder for every node withBRANCH_MEMBER(6) mode. Each node’s set is delimited by aNaNsentinel. May be empty if no node usesBRANCH_MEMBER.n_targets – Number of regression targets.
aggregate_function – 0=AVERAGE, 1=SUM (default), 2=MIN, 3=MAX.
post_transform – 0=NONE (default), 1=SOFTMAX.
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
template<typename T>
-
class TreeEnsembleClassifier : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation helper for the
ai.onnx.mlTreeEnsembleClassifieroperator (opsets 1, 3, 5 in theai.onnx.mldomain).Traverses a classic-encoding decision tree ensemble and returns:
Y: top class label tensor of shape[N].Z: class score tensor of shape[N, E].
Supports integer and string class labels.
Public Functions
-
template<typename T>
std::pair<Tensor, Tensor> operator()(const Tensor &x, const std::vector<int64_t> &nodes_treeids, const std::vector<int64_t> &nodes_nodeids, const std::vector<int64_t> &nodes_featureids, const std::vector<float> &nodes_values, const std::vector<std::string> &nodes_modes, const std::vector<int64_t> &nodes_truenodeids, const std::vector<int64_t> &nodes_falsenodeids, const std::vector<int64_t> &nodes_missing, const std::vector<int64_t> &class_treeids, const std::vector<int64_t> &class_nodeids, const std::vector<int64_t> &class_ids, const std::vector<float> &class_weights, const std::vector<int64_t> &classlabels_int64s, const std::vector<float> &base_values, const std::string &post_transform) const#
-
template<typename T>
std::pair<Tensor, Tensor> operator()(const Tensor &x, const std::vector<int64_t> &nodes_treeids, const std::vector<int64_t> &nodes_nodeids, const std::vector<int64_t> &nodes_featureids, const std::vector<float> &nodes_values, const std::vector<std::string> &nodes_modes, const std::vector<int64_t> &nodes_truenodeids, const std::vector<int64_t> &nodes_falsenodeids, const std::vector<int64_t> &nodes_missing, const std::vector<int64_t> &class_treeids, const std::vector<int64_t> &class_nodeids, const std::vector<int64_t> &class_ids, const std::vector<float> &class_weights, const std::vector<std::string> &classlabels_strings, const std::vector<float> &base_values, const std::string &post_transform) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
class TreeEnsembleRegressor : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation helper for the
ai.onnx.mlTreeEnsembleRegressoroperator (opsets 1, 3, 5 in theai.onnx.mldomain).Traverses a classic-encoding decision tree ensemble and returns a float tensor of regression scores with shape
[N, n_targets].This implementation supports
aggregate_functionvalues “SUM” (default), “AVERAGE”, “MIN”, and “MAX”, andpost_transformvalue “NONE”.Public Functions
-
template<typename T>
Tensor operator()(const Tensor &x, const std::vector<int64_t> &nodes_treeids, const std::vector<int64_t> &nodes_nodeids, const std::vector<int64_t> &nodes_featureids, const std::vector<float> &nodes_values, const std::vector<std::string> &nodes_modes, const std::vector<int64_t> &nodes_truenodeids, const std::vector<int64_t> &nodes_falsenodeids, const std::vector<int64_t> &nodes_missing, const std::vector<int64_t> &target_treeids, const std::vector<int64_t> &target_nodeids, const std::vector<int64_t> &target_ids, const std::vector<float> &target_weights, int64_t n_targets, const std::string &aggregate_function, const std::string &post_transform, const std::vector<float> &base_values) const# - Parameters:
x – Input feature matrix, shape
[N, F]or[F].nodes_treeids – Tree id per node.
nodes_nodeids – Node id per node (root is 0 per tree).
nodes_featureids – Feature index per node.
nodes_values – Split threshold per node (float variant).
nodes_modes – Node mode strings per node (e.g. “BRANCH_LEQ”).
nodes_truenodeids – True-branch child node id per node.
nodes_falsenodeids – False-branch child node id per node.
nodes_missing – 1 if a NaN input follows the true branch; 0 for false. May be empty (treated as all 0).
target_treeids – Tree id per leaf entry.
target_nodeids – Node id per leaf entry.
target_ids – Target index per leaf entry.
target_weights – Weight contribution per leaf entry.
n_targets – Total number of regression targets.
aggregate_function – “SUM” | “AVERAGE” | “MIN” | “MAX”.
post_transform – “NONE”.
base_values – Added to the aggregated output; empty means 0.
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
template<typename T>
-
class ZipMap : public onnx_light::onnx_kernels::kernel::KernelBase#
- #include <include_traditionalml_kernels.h>
Reference implementation helper for the
ai.onnx.mlZipMapoperator (since opset 1 in theai.onnx.mldomain).ZipMapreturns asequence<map<...>>value, which the backend test runtime materializes as a float tensor containing the map values:1-D input
[C]-> tensor[1, C]2-D input
[N, C]-> tensor[N, C]
The map keys come from either
classlabels_int64sorclasslabels_stringsand are validated by this helper through theclass_labelsargument size.Public Functions
-
void operator()(const Tensor &x, const std::vector<std::string> &class_labels, Tensor &output) const#
-
inline explicit KernelBase(const KernelContext &ctx)#
Public Static Functions
-
static inline constexpr bool CanRunInPlace() noexcept#
-
class ArrayFeatureExtractor : public onnx_light::onnx_kernels::kernel::KernelBase#
-
namespace kernel#
-
namespace onnx_kernels#