ai.onnx.ml - ArrayFeatureExtractor#

ArrayFeatureExtractor - 1 (ai.onnx.ml)#

Version#

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

Summary#

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

Inputs#

  • X (heterogeneous) - T:

    Data to be selected

  • Y (heterogeneous) - tensor(int64):

    The indices, based on 0 as the first index of any dimension.

Outputs#

  • Z (heterogeneous) - T:

    Selected output data as an array

Type Constraints#

  • T in ( tensor(double), tensor(float), tensor(int32), tensor(int64), tensor(string) ):

    The input must be a tensor of a numeric type or string. The output will be of the same tensor type.

Examples#

default#

import numpy as np
import onnx

node = onnx.helper.make_node(
    "ArrayFeatureExtractor",
    inputs=["x", "y"],
    outputs=["z"],
    domain="ai.onnx.ml",
)

x = np.arange(12).reshape((3, 4)).astype(np.float32)
y = np.array([0, 1], dtype=np.int64)
z = np.array([[0, 4, 8], [1, 5, 9]], dtype=np.float32).T
expect(
    node,
    inputs=[x, y],
    outputs=[z],
    name="test_ai_onnx_ml_array_feature_extractor",
)