[GPU] Support negative indice for static (#20909)
This commit is contained in:
parent
d1f72e2d01
commit
ed0ce165ce
@ -106,7 +106,12 @@ void CreateGatherOpBase(ProgramBuilder& p, const std::shared_ptr<T>& op, const i
|
||||
|
||||
// Set tensors for crop shape and offset
|
||||
ov::Shape start_offset(input_shape.size());
|
||||
start_offset[0] = static_cast<size_t>(result);
|
||||
int32_t new_offset0 = static_cast<int32_t>(result);
|
||||
if (support_neg_ind && new_offset0 < 0) {
|
||||
new_offset0 += static_cast<int32_t>(start_offset.size());
|
||||
}
|
||||
|
||||
start_offset[0] = static_cast<size_t>(new_offset0);
|
||||
auto offsetTensor = tensor_from_dims(start_offset, 0);
|
||||
auto outTensor = tensor_from_dims(out_shape, 1);
|
||||
|
||||
|
@ -534,4 +534,29 @@ INSTANTIATE_TEST_CASE_P(smoke,
|
||||
Gather8withIndicesDataLayerTest::getTestCaseName
|
||||
);
|
||||
|
||||
std::vector<std::vector<int64_t>> nagativeSingleindicesData = {
|
||||
{-1},
|
||||
{-2},
|
||||
{-3}
|
||||
};
|
||||
|
||||
gather7ParamsTuple dummyParams2 = {
|
||||
ov::test::static_shapes_to_test_representation(std::vector<ov::Shape>({{4, 8, 2, 2}})),
|
||||
ov::Shape({}),
|
||||
std::tuple<int, int>{0, 0},
|
||||
ov::element::f32,
|
||||
ov::test::utils::DEVICE_GPU,
|
||||
};
|
||||
|
||||
const auto gatherWithNagativeIndicesParams = testing::Combine(
|
||||
testing::Values(dummyParams2),
|
||||
testing::ValuesIn(nagativeSingleindicesData)
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_Gather8NagativeIndice,
|
||||
Gather8withIndicesDataLayerTest,
|
||||
gatherWithNagativeIndicesParams,
|
||||
Gather8withIndicesDataLayerTest::getTestCaseName
|
||||
);
|
||||
|
||||
} // namespace
|
||||
|
Loading…
Reference in New Issue
Block a user