ai.onnx.Selu

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

Description

Applies the Scaled Exponential Linear Unit (SELU) function elementwise: y = gamma * x for x > 0, and y = gamma * (alpha * exp(x) - alpha) for x <= 0. The alpha and gamma coefficients default to the standard SELU values that induce self-normalizing properties.

See the ONNX Selu spec for the reference semantics.

Inputs

Name Bind key Logical dtype Rank Shape Description Presence
X x T Values transformed elementwise by the SELU activation. required

Outputs

Name Bind key Logical dtype Rank Shape Description Presence
Y y T same as X same as X Output tensor with SELU applied elementwise; same shape as the input. required

Attributes

Default values (overridable per request):

Attribute Default Description
alpha 1.6732631921768188 Coefficient applied to the exponential term for negative inputs; defaults to the standard SELU value ~1.6733.
gamma 1.0507010221481323 Scaling coefficient applied to both branches of the activation; defaults to the standard SELU value ~1.0507.

Type constraints

Variable Allowed dtypes
T float32, float16

Files

Use with @huggingface/kernels

The loader derives every required output's shape and logical dtype from the manifest contract and this call. It then allocates the result tensors automatically.

The version: 1 option selects the published kernel contract; it is independent of any operator opset, contrib since_version, or model version.

Replace each *Data placeholder with a typed array containing the corresponding input data.

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

const kernel = await getKernel("webgpu-kernels/ai.onnx.Selu", { version: 1 });
const { y } = await kernel({ x: { data: xData, shape: [4] } });
Downloads last month
-
kernel
webgpu
wgsl
apache-2.0
WebGPU

Requires WebGPU support. See the compatibility table.