Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[js/webgpu] Fix issue to run model demucs #22074

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions js/web/lib/wasm/jsep/webgpu/ops/conv-transpose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ const calculateOutputShapeAndPads = (
) => {
const spatialRank = inputShape.length - 2;
const updateOutputShape = outputShape.length === 0;
if (outputPadding.length === 0) {
for (let i = 0; i < spatialRank; ++i) {
outputPadding.push(0);
}
if (outputPadding.length < spatialRank) {
outputPadding.push(...Array(spatialRank - outputPadding.length).fill(0));
}
const batchSize = inputShape[0];
const outChannels = kernelShape[isChannelLast ? 3 : 1] * group;
Expand Down
5 changes: 4 additions & 1 deletion js/web/lib/wasm/jsep/webgpu/ops/conv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ const validateInputs = (inputs: readonly TensorView[], attributes: ConvAttribute

const getAdjustedConvAttributes = <T extends ConvAttributes>(attributes: T, inputs: readonly TensorView[]): T => {
const kernelShape = attributes.kernelShape.slice();
// if kernelShape is not specified in the attributes of this op, infer it from the weight tensor dims
// if kernelShape is not well specified in the attributes, infer it from the weight tensor dims
if (kernelShape.length < inputs[1].dims.length - 2) {
kernelShape.push(...Array(inputs[1].dims.length - 2 - kernelShape.length).fill(0));
}
for (let i = 2; i < inputs[1].dims.length; ++i) {
if (kernelShape[i - 2] === 0) {
kernelShape[i - 2] = inputs[1].dims[i];
Expand Down
Loading