Skip to content

Commit

Permalink
Reduce fp16 overflow fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dakenf committed Sep 20, 2023
1 parent fff0c5d commit 31e40b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/web/lib/wasm/jsep/webgpu/ops/reduce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ export const reduceMean = (context: ComputeContext, attributes: ReduceAttributes
}

return [
`var value = ${output.type.storage}(0);`,
'var sum = f32(0);',
'',
`value += ${input.getByOffset('inputOffset')};`,
`value = value / ${size}.;`,
`sum += f32(${input.getByOffset('inputOffset')});`,
`let value = ${output.type.value}(sum / ${size});`,
];
};
context.compute(createReduceProgramInfoLoader(context.inputs, 'ReduceMean', attributes, reduceOp), {inputs: [0]});
Expand Down

0 comments on commit 31e40b1

Please sign in to comment.