sync 6fdf6301e2bb
Browse files- README.md +3 -3
- build/webgpu/dropout.wgsl.jinja +1 -3
- build/webgpu/manifest.json +3 -3
- build/webgpu/metadata.json +5 -5
README.md
CHANGED
|
@@ -41,14 +41,14 @@ See the [ONNX `Dropout` spec](https://onnx.ai/onnx/operators/onnx__Dropout.html)
|
|
| 41 |
- [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, per-variant templates, provenance)
|
| 42 |
- [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)
|
| 43 |
- [`test.json`](build/webgpu/test.json) — correctness cases
|
| 44 |
-
- [`bench.json`](build/webgpu/bench.json) — benchmark
|
| 45 |
- [`dropout-vec4.wgsl.jinja`](build/webgpu/dropout-vec4.wgsl.jinja)
|
| 46 |
- [`dropout.wgsl.jinja`](build/webgpu/dropout.wgsl.jinja)
|
| 47 |
|
| 48 |
## Use with `@huggingface/kernels`
|
| 49 |
|
| 50 |
```sh
|
| 51 |
-
npm install --save-exact @huggingface/kernels@0.0.1-preview.
|
| 52 |
```
|
| 53 |
|
| 54 |
Required output shapes and logical data types are inferred from the supplied inputs and attributes; result tensors are allocated automatically.
|
|
@@ -62,5 +62,5 @@ Replace each `*Data` placeholder with a typed array containing the corresponding
|
|
| 62 |
import { getKernel } from "@huggingface/kernels";
|
| 63 |
|
| 64 |
const kernel = await getKernel("webgpu-kernels/ai.onnx.Dropout", { version: 1 });
|
| 65 |
-
const { y } = await kernel({ x: { data: xData, shape: [] } });
|
| 66 |
```
|
|
|
|
| 41 |
- [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, per-variant templates, provenance)
|
| 42 |
- [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)
|
| 43 |
- [`test.json`](build/webgpu/test.json) — correctness cases
|
| 44 |
+
- [`bench.json`](build/webgpu/bench.json) — benchmark cases
|
| 45 |
- [`dropout-vec4.wgsl.jinja`](build/webgpu/dropout-vec4.wgsl.jinja)
|
| 46 |
- [`dropout.wgsl.jinja`](build/webgpu/dropout.wgsl.jinja)
|
| 47 |
|
| 48 |
## Use with `@huggingface/kernels`
|
| 49 |
|
| 50 |
```sh
|
| 51 |
+
npm install --save-exact @huggingface/kernels@0.0.1-preview.3
|
| 52 |
```
|
| 53 |
|
| 54 |
Required output shapes and logical data types are inferred from the supplied inputs and attributes; result tensors are allocated automatically.
|
|
|
|
| 62 |
import { getKernel } from "@huggingface/kernels";
|
| 63 |
|
| 64 |
const kernel = await getKernel("webgpu-kernels/ai.onnx.Dropout", { version: 1 });
|
| 65 |
+
const { y } = await kernel({ x: { data: xData, shape: [3] } });
|
| 66 |
```
|
build/webgpu/dropout.wgsl.jinja
CHANGED
|
@@ -12,9 +12,7 @@ fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
|
|
| 12 |
for (var i = begin; i < end; i = i + 1u) {
|
| 13 |
{%- endmacro %}
|
| 14 |
{% macro flat_tail_close() %}
|
| 15 |
-
}
|
| 16 |
-
{% endmacro %}
|
| 17 |
-
|
| 18 |
{{ env.wgsl.resourceDeclarations }}
|
| 19 |
|
| 20 |
{{ flat_tail_open() }}
|
|
|
|
| 12 |
for (var i = begin; i < end; i = i + 1u) {
|
| 13 |
{%- endmacro %}
|
| 14 |
{% macro flat_tail_close() %}
|
| 15 |
+
}{% endmacro %}
|
|
|
|
|
|
|
| 16 |
{{ env.wgsl.resourceDeclarations }}
|
| 17 |
|
| 18 |
{{ flat_tail_open() }}
|
build/webgpu/manifest.json
CHANGED
|
@@ -11,9 +11,9 @@
|
|
| 11 |
"tunables": { "WORKGROUP_SIZE": { "default": 256 } },
|
| 12 |
"when": ["numel(shapes.x) == numel(shapes.y)", "f16Ok(dtypes.T)"],
|
| 13 |
"bindings": {
|
| 14 |
-
"x": { "
|
| 15 |
-
"y": { "
|
| 16 |
-
"params": { "
|
| 17 |
},
|
| 18 |
"variants": [
|
| 19 |
{
|
|
|
|
| 11 |
"tunables": { "WORKGROUP_SIZE": { "default": 256 } },
|
| 12 |
"when": ["numel(shapes.x) == numel(shapes.y)", "f16Ok(dtypes.T)"],
|
| 13 |
"bindings": {
|
| 14 |
+
"x": { "elementType": "$vectorScalar" },
|
| 15 |
+
"y": { "elementType": "$vectorScalar" },
|
| 16 |
+
"params": { "struct": [{ "name": "count", "type": "u32", "value": "numel(shapes.y)" }] }
|
| 17 |
},
|
| 18 |
"variants": [
|
| 19 |
{
|
build/webgpu/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "ai.onnx.Dropout",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"backend": { "type": "webgpu" },
|
|
@@ -9,14 +9,14 @@
|
|
| 9 |
"files": {
|
| 10 |
"bench.json": "fVNuUMD7BfQ3nJR3eRwDI9KTKLDHxJ7nYLM+GFpZ/1c=",
|
| 11 |
"dropout-vec4.wgsl.jinja": "JUknycZuRkgVYuCnq8ckZ/LBoSTO5iUHRuKup7BQOiA=",
|
| 12 |
-
"dropout.wgsl.jinja": "
|
| 13 |
-
"manifest.json": "
|
| 14 |
"test.json": "GRnQ4E0z1CRr4lQUpmmwwjFsc5G9ur95bbbvHvHD5Ok="
|
| 15 |
}
|
| 16 |
},
|
| 17 |
-
"provenance": { "kernel": { "sha": "
|
| 18 |
"webgpu": {
|
| 19 |
-
"manifestSpec": "2.
|
| 20 |
"variants": {
|
| 21 |
"inference_copy_vec4": ["dropout-vec4.wgsl.jinja"],
|
| 22 |
"inference_copy_mask_vec4": ["dropout-vec4.wgsl.jinja"],
|
|
|
|
| 1 |
{
|
| 2 |
"name": "ai.onnx.Dropout",
|
| 3 |
+
"id": "_ai_onnx_dropout_webgpu_9865959",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"backend": { "type": "webgpu" },
|
|
|
|
| 9 |
"files": {
|
| 10 |
"bench.json": "fVNuUMD7BfQ3nJR3eRwDI9KTKLDHxJ7nYLM+GFpZ/1c=",
|
| 11 |
"dropout-vec4.wgsl.jinja": "JUknycZuRkgVYuCnq8ckZ/LBoSTO5iUHRuKup7BQOiA=",
|
| 12 |
+
"dropout.wgsl.jinja": "nQELCXiQ6gOU58XL2AH38ZvFWAb9dNErMp6AuTPNBss=",
|
| 13 |
+
"manifest.json": "88KRuxytrOEKxr+OpBxw6MHIB8IFpgd1nZACsDRxLqY=",
|
| 14 |
"test.json": "GRnQ4E0z1CRr4lQUpmmwwjFsc5G9ur95bbbvHvHD5Ok="
|
| 15 |
}
|
| 16 |
},
|
| 17 |
+
"provenance": { "kernel": { "sha": "6fdf6301e2bbcc2f03bf1eaf493b7ad55ef33afc", "dirty": false } },
|
| 18 |
"webgpu": {
|
| 19 |
+
"manifestSpec": "2.1",
|
| 20 |
"variants": {
|
| 21 |
"inference_copy_vec4": ["dropout-vec4.wgsl.jinja"],
|
| 22 |
"inference_copy_mask_vec4": ["dropout-vec4.wgsl.jinja"],
|