|
Download README.md from webgpu-kernels/com.microsoft.SkipSimplifiedLayerNormalization: direct link, hf CLI and curl.
- Browser
- Download file 3.67 kB
-
https://huggingface.co/kernels/webgpu-kernels/com.microsoft.SkipSimplifiedLayerNormalization/resolve/69e74ac9861044a159fcded473679f96802b4c8f/README.md
- Command line
-
hf download hf://webgpu-kernels/com.microsoft.SkipSimplifiedLayerNormalization@69e74ac9861044a159fcded473679f96802b4c8f/README.md
-
curl -L -o README.md https://huggingface.co/kernels/webgpu-kernels/com.microsoft.SkipSimplifiedLayerNormalization/resolve/69e74ac9861044a159fcded473679f96802b4c8f/README.md
3.67 kB
| library_name: kernels | |
| license: apache-2.0 | |
| tags: | |
| - kernel | |
| - webgpu | |
| - wgsl | |
| # com.microsoft.SkipSimplifiedLayerNormalization | |
| `com.microsoft` · ONNX Runtime contrib operator · contrib since_version 1 | |
| ## Description | |
| Adds `input` and `skip` (plus optional `bias`), then applies RMS normalization scaled by `gamma`. The optional second output exposes the pre-normalization sum. The schema's training-only mean and inverse-standard-deviation outputs are not implemented. | |
| See the [ONNX Runtime `SkipSimplifiedLayerNormalization` contrib-operator spec](https://github.com/microsoft/onnxruntime/blob/main/docs/ContribOperators.md#com.microsoft.SkipSimplifiedLayerNormalization) for the reference semantics. | |
| ## Inputs | |
| | Name | Bind key | Logical dtype | Rank | Shape | Description | Presence | | |
| | --- | --- | --- | --- | --- | --- | --- | | |
| | `input` | `inputT` | `T` | — | — | Input tensor of shape `(token_count, hidden_size)` or `(batch, sequence, hidden_size)`, normalized over the last axis. | required | | |
| | `skip` | `skipT` | `T` | — | — | Residual tensor of the same shape as `input`, added before normalization. | required | | |
| | `gamma` | `gammaT` | `T` | `1` | — | 1-D scale tensor with shape `(hidden_size)` applied after normalization. | required | | |
| | `bias` | `biasT` | `T` | `1` | — | Optional 1-D bias tensor with shape `(hidden_size)` added to the `input + skip` sum. | optional | | |
| ## Outputs | |
| | Name | Bind key | Logical dtype | Rank | Shape | Description | Presence | | |
| | --- | --- | --- | --- | --- | --- | --- | | |
| | `output` | `outputT` | `T` | same as `input` | same as `input` | Normalized output tensor with the same shape as `input`. | required | | |
| | `input_skip_bias_sum` | `residualT` | `T` | same as `input` | same as `input` | Sum of `input`, `skip`, and optional `bias` before normalization, with the same shape as `input`. | optional | | |
| ## Attributes | |
| Default values (overridable per request): | |
| | Attribute | Default | Description | | |
| | --- | --- | --- | | |
| | `epsilon` | `9.999999960041972e-13` | Non-negative epsilon added to the mean square before taking the square root. | | |
| ## Type constraints | |
| | Variable | Allowed dtypes | | |
| | --- | --- | | |
| | `T` | `float32`, `float16` | | |
| ## Device requirements | |
| Some implementation variants require `shader-f16`. These are route-specific capabilities, not package-wide requirements; availability also depends on the request shape and dtype. | |
| ## Files | |
| - [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, provenance) | |
| - [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth) | |
| - [`test.json`](build/webgpu/test.json) — correctness cases | |
| - [`bench.json`](build/webgpu/bench.json) — benchmark + tuning cases | |
| - [`norm-skip-row-vec4.wgsl.jinja`](build/webgpu/norm-skip-row-vec4.wgsl.jinja) | |
| - [`norm-skip-row.wgsl.jinja`](build/webgpu/norm-skip-row.wgsl.jinja) | |
| ## 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. | |
| ```js | |
| import { getKernel } from "@huggingface/kernels"; | |
| const kernel = await getKernel("webgpu-kernels/com.microsoft.SkipSimplifiedLayerNormalization", { version: 1 }); | |
| const { outputT } = await kernel({ | |
| inputT: { data: inputTData, shape: [2, 4] }, | |
| skipT: { data: skipTData, shape: [2, 4] }, | |
| gammaT: { data: gammaTData, shape: [4] }, | |
| }); | |
| ``` | |