onnxruntime
db8739b3 - Fix WebGPU reduction kernels for empty tensor inputs

Commit
3 days ago
Fix WebGPU reduction kernels for empty tensor inputs Add proper empty-set identity values to WebGPU reduction shader generation. Previously, the empty input path used loop_header_/ loop_footer_ which referenced undefined variables (first_element for Max/Min) or divided by zero (ReduceMean). Changes: - Add reduce_op_empty_identity_map with WGSL expressions for each reduction op's ONNX identity value (Max→-inf, Min→+inf, Sum→0, Prod→1, Mean→0, etc.) - Modify ReduceNaiveProgram::GenerateShaderCode to directly output the identity value for empty inputs instead of running broken loop header/footer code - Enable allow_empty_input for ReduceMax and ReduceMin WebGPU kernels (was false, causing CheckInput to reject empty tensors) - Remove WebGPU from empty tensor test exclusion lists Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Justin Chu <justinchu@microsoft.com>
Author
Parents
Loading