Skip to content

Commit 9918dff

Browse files
a-sullychromium-wpt-export-bot
authored andcommitted
webnn: Set a max operand rank of 8
We likely eventually want this to be part of MLOpSupportsLimits, but for now this allows us to replace some checked-casts in favor of static-casts, and not need to worry about tensors with absurd ranks See webmachinelearning/webnn#456 Bug: 329482489 Cq-Include-Trybots: luci.chromium.try:win11-blink-rel,mac14-blink-rel,mac14.arm64-blink-rel Change-Id: I021d3b30ea1b8f5f3bef1725130fd2e4c569f494 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5639505 Reviewed-by: ningxin hu <[email protected]> Reviewed-by: Phillis Tang <[email protected]> Reviewed-by: Koji Ishii <[email protected]> Commit-Queue: Austin Sullivan <[email protected]> Cr-Commit-Position: refs/heads/main@{#1344800}
1 parent 1cbcd67 commit 9918dff

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// META: title=ensure an MLOperand cannot be created with an invalid rank
2+
// META: global=window,dedicatedworker
3+
// META: variant=?cpu
4+
// META: variant=?gpu
5+
// META: variant=?npu
6+
// META: script=../resources/utils_validation.js
7+
8+
promise_test(async t => {
9+
const builder = new MLGraphBuilder(context);
10+
11+
const shapeWithLargeRank = Array(10).fill(2);
12+
assert_throws_js(
13+
TypeError,
14+
() => builder.input(
15+
'a', {dataType: 'float32', dimensions: shapeWithLargeRank}));
16+
}, 'Throw if rank is too large');

0 commit comments

Comments
 (0)