[js/webgpu] fix bcast in where (#19009)

This commit is contained in:
Guenther Schmuelling 2024-01-11 12:13:24 -08:00 committed by GitHub
parent 53497702a6
commit d0bac8216d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,7 +76,6 @@ const createWhereOpProgramInfo = (inputs: readonly TensorView[]): ProgramInfo =>
const isBroadcast = !(ShapeUtil.areEqual(dimsA, dimsB) && ShapeUtil.areEqual(dimsB, dimsC));
let outputShape = dimsA;
let outputSize = ShapeUtil.size(dimsA);
const vecSize = Math.ceil(outputSize / 4);
// TODO: deal with zero-sized tensors (eg. dims=[1,0])
if (isBroadcast) {
@ -88,6 +87,8 @@ const createWhereOpProgramInfo = (inputs: readonly TensorView[]): ProgramInfo =>
outputSize = ShapeUtil.size(outputShape);
}
const vecSize = Math.ceil(outputSize / 4);
return {
name: 'Where',
shaderCache: {inputDependencies: ['rank', 'rank', 'rank']},