ai.onnx.Concat

ai.onnx · standard ONNX operator · ONNX opset ≥ 13

Description

Concatenates a list of tensors along a single axis into one output tensor. All inputs must have the same shape except along the concatenation axis, which may differ between inputs. Negative axis values count from the end of the rank.

See the ONNX Concat spec for the reference semantics.

Inputs

Name Logical dtype Rank Shape Description Presence
inputs T — derived per tensor Tensor i to join; every tensor has the same rank and shape except along axis. 1 to 9 tensors

Outputs

Name Logical dtype Rank Shape Description Presence
concat_result T same as inputs0 derived Concatenated output tensor. required

Attributes

Attributes and default values (overridable per request):

Attribute Default Description
axis — Required axis along which to concatenate; negative values count from the back, and the accepted range is [-r, r-1] where r is the rank of the inputs.

Type constraints

Variable Allowed dtypes
T float32, float16, uint32, int32, int16, uint8, int8, bool, int64

Files

Use with @huggingface/kernels

npm install --save-exact @huggingface/kernels@0.0.1-preview.4

Paste the example into a browser app that resolves npm imports. Serve the app over HTTPS or localhost with WebGPU available.

Required output shapes and logical data types are inferred from the supplied inputs and attributes; result tensors are allocated automatically.

The version: 1 option selects the published kernel contract; it is independent of any operator opset, contrib since_version, or model version. It follows the v1 branch as fixes land. To pin exact artifact bytes, pass a 40-character commit revision instead of version.

import { getKernel } from "@huggingface/kernels";

const kernel = await getKernel("webgpu-kernels/ai.onnx.Concat", { version: 1 });

const inputs0Data = Int16Array.of(-32768);

const { concat_result } = await kernel({ inputs: [{ data: inputs0Data, shape: [1] }] }, {
  attrs: { axis: 0 },
});
console.log({ concat_result });
Downloads last month
-
kernel
webgpu
wgsl
apache-2.0
WebGPU

Requires WebGPU support. See the compatibility table.