Skip to content

Commit f00823f

Browse files
committed
fix zero sized input for where op on webgpu
1 parent 8fe4804 commit f00823f

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)