Skip to content

Commit 3f4ab76

Browse files
authored
fix zero size input for where op on webgpu (#26576)
fixes an issue with edge-tam-encoder reported by hf
1 parent 4f600bb commit 3f4ab76

File tree

1 file changed

+4
-0
lines changed
  • onnxruntime/core/providers/webgpu/tensor

1 file changed

+4
-0
lines changed

onnxruntime/core/providers/webgpu/tensor/where.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ Status Where::ComputeInternal(ComputeContext& context) const {
126126
TensorShape output_shape;
127127
ORT_RETURN_IF_ERROR(ComputeOutputShape(cond_shape, x_shape, y_shape, output_shape));
128128
auto* output_tensor = context.Output(0, output_shape);
129+
if (output_tensor->Shape().Size() == 0) {
130+
return Status::OK();
131+
}
132+
129133
constexpr int component = 4;
130134
uint32_t vec_size = onnxruntime::narrow<uint32_t>((output_shape.Size() + 3) / component);
131135
const auto is_broadcast = !(x_shape == y_shape &&

0 commit comments

Comments
 (0)