File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
onnxruntime/core/providers/webgpu Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,10 @@ Status MatMul::ComputeInternal(ComputeContext& context) const {
109109
110110 ORT_RETURN_IF_ERROR (helper.Compute (a->Shape (), b->Shape ()));
111111 auto * output_tensor = context.Output (0 , helper.OutputShape ());
112+ if (output_tensor->Shape ().Size () == 0 ) {
113+ // If the output tensor is empty, we can return early.
114+ return Status::OK ();
115+ }
112116 bool has_bias = context.InputCount () > 2 ;
113117
114118 if (helper.N () < 8 && helper.K () < 8 ) { // call MatMulNaiveProgram
Original file line number Diff line number Diff line change @@ -153,6 +153,10 @@ Status ScatterND::ComputeInternal(ComputeContext& context) const {
153153 const size_t components = 1 ;
154154 auto output_size = static_cast <uint32_t >((indices_shape.SizeToDimension (indices_rank - 1 ) + components - 1 ) / components);
155155 auto * output = context.Output (0 , input_shape);
156+ if (output_size == 0 ) {
157+ // If the output tensor is empty, we can return early.
158+ return Status::OK ();
159+ }
156160 MLDataType data_type = input->DataType ();
157161 const void * source = input->DataRaw ();
158162 void * target = output->MutableDataRaw ();
You can’t perform that action at this time.
0 commit comments