Skip to content

Commit

Permalink
[onert/backend] Fix checking indices tensor shape in GatherLayer (#14284
Browse files Browse the repository at this point in the history
)

This fixes checking indices tensor shape in GatherLayer.
If dimension count is 4 and dim(0) != 0, it should throw exception, but it didn't.

ONE-DCO-1.0-Signed-off-by: Seockho Kim [email protected]
  • Loading branch information
seockho-kim authored Nov 1, 2024
1 parent 4f61fcb commit cf45dcc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/onert/backend/cpu/ops/GatherLayer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void GatherLayer::runByGGMLQuantInputType()
if (getShape(_input).DimensionsCount() != 2)
throw std::runtime_error("Gather: block quantized input tensor must be rank 2");

if (getShape(_indices).DimensionsCount() > 4 &&
if (getShape(_indices).DimensionsCount() >= 4 &&
(getShape(_indices).DimensionsCount() != 4 || getShape(_indices).Dims(0) != 1))
throw std::runtime_error("Gather: invalid indices tensor shape");

Expand Down

0 comments on commit cf45dcc

Please sign in to comment.