[webgpu] fix Split operator implementation when input is 1D (#23376)

### Description

[webgpu] fix Split operator implementation when input is 1D
This commit is contained in:
Yulong Wang 2025-01-15 21:01:05 -08:00 committed by GitHub
parent e51bcfb541
commit 1d97d6ef55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -65,11 +65,11 @@ Status SplitProgram::GenerateShaderCode(ShaderHelper& shader) const {
shader.MainFunctionBody() << shader.GuardAgainstOutOfBoundsWorkgroupSizes("uniforms.input_size")
<< " var indices = " << input.OffsetToIndices("global_idx") << ";\n"
<< " var index = indices[" << axis_ << "];\n"
<< " var index = " << input.IndicesGet("indices", axis_) << ";\n"
<< " let output_number = calculate_output_index(index);\n"
<< " if (output_number != 0u) {\n"
<< " index -= uniforms.sizes_in_split_axis[output_number - 1u];\n"
<< " indices[" << axis_ << "] = index;\n"
<< " " << input.IndicesSet("indices", axis_, "index") << "\n"
<< " }\n"
<< " write_buffer_data(output_number, global_idx, indices);\n";