Skip to content

Commit 5d8f984

Browse files
committed
openvino backend fix for values shape issue
1 parent 767f192 commit 5d8f984

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ggml/src/ggml-openvino/openvino/op/set_rows.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <openvino/op/convert.hpp>
99
#include <openvino/op/gather.hpp>
1010
#include <openvino/op/reshape.hpp>
11+
#include <openvino/op/unsqueeze.hpp>
1112
#include <openvino/op/scatter_update.hpp>
1213
#include <openvino/op/shape_of.hpp>
1314
#include <openvino/op/slice.hpp>
@@ -54,8 +55,11 @@ OutputVector translate_set_rows(const NodeContext& context) {
5455
auto updated = std::make_shared<ov::op::v3::ScatterUpdate>(dst_reshaped, indices_reshaped, data_reshaped, zero);
5556
res = std::make_shared<ov::op::v1::Reshape>(updated, std::make_shared<ov::op::v0::ShapeOf>(dst), false);
5657
} else {
57-
auto data_reshaped = std::make_shared<ov::op::v1::Reshape>(data, std::make_shared<ov::op::v0::ShapeOf>(dst), false);
58-
res = std::make_shared<ov::op::v0::Concat>(OutputVector{dst, data_reshaped}, 1);
58+
// TODO: Better solution would be to reshape the data into 4D at first place (for stateful model)
59+
if (data.get_partial_shape().rank() + 1 == dst.get_partial_shape().rank()) {
60+
data = std::make_shared<ov::op::v0::Unsqueeze>(data, zero);
61+
}
62+
res = std::make_shared<ov::op::v0::Concat>(OutputVector{dst, data}, 1);
5963
}
6064
return rename_outputs_with_suffix({res}, context.get_name());
6165
}

0 commit comments

Comments
 (0)