Skip to content

Commit

Permalink
[js/webgpu] Fix wrong shape in maxpool
Browse files Browse the repository at this point in the history
  • Loading branch information
axinging committed Jul 30, 2024
1 parent 5d78b9a commit 64f1849
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions js/web/lib/wasm/jsep/webgpu/ops/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ const getAdjustedPoolAttributesAndOutputShape = <AttributeType extends AveragePo
inputShapeAsChannelFirst.splice(1, 0, inputShapeAsChannelFirst.pop()!); // Move channel to the second position.
}
const hasDilations = Object.hasOwnProperty.call(attributes, 'dilations');
const kernelShape = attributes.kernelShape.slice();
const strides = attributes.strides.slice();
let kernelShape = attributes.kernelShape.slice();
if (kernelShape[kernelShape.length - 1] === 0) {
kernelShape.pop();
}
let strides = attributes.strides.slice();
if (strides[strides.length - 1] === 0) {
strides.pop();
}
const dilations: number[] = hasDilations ? (attributes as MaxPoolAttributes).dilations.slice() : [];
const pads = attributes.pads.slice();
PoolConvUtil.adjustPoolAttributes(isGlobalOperator, inputShapeAsChannelFirst, kernelShape, strides, dilations, pads);
Expand Down
1 change: 1 addition & 0 deletions js/web/test/suite-test-list.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,7 @@
"matmul.jsonc",
"matmulnbits.jsonc",
"matmul-broadcast.jsonc",
"max-pool.jsonc",
"mul.jsonc",
"mul_int32.jsonc",
"multihead-attention.jsonc",
Expand Down

0 comments on commit 64f1849

Please sign in to comment.