-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GPU] Consider the node which is shape_of subgraph and ocl_impl in up…
…date_shape() (cherrypick from PR#27551) (#27670) ### Details: - Consider the node which is shape_of subgraph and ocl_impl in update_shape() ### Tickets: - 154135
- Loading branch information
1 parent
5894555
commit d165118
Showing
2 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/plugins/intel_gpu/tests/unit/dynamic_execution/update_shape_test.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright (C) 2022 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "test_utils.h" | ||
|
||
#include <intel_gpu/primitives/input_layout.hpp> | ||
#include <intel_gpu/primitives/data.hpp> | ||
#include <intel_gpu/primitives/shape_of.hpp> | ||
#include <intel_gpu/primitives/broadcast.hpp> | ||
#include <intel_gpu/primitives/gather.hpp> | ||
#include <intel_gpu/primitives/non_zero.hpp> | ||
|
||
#include "program_wrapper.h" | ||
|
||
#include <cmath> | ||
#include <algorithm> | ||
|
||
using namespace cldnn; | ||
using namespace ::tests; | ||
|
||
namespace update_shape_tests { | ||
TEST(update_shape_test, ocl_impl_in_shapeof_subgraph) { | ||
auto& engine = get_test_engine(); | ||
|
||
layout const1_gather_layout = layout{ov::PartialShape{1}, data_types::i32, format::bfyx}; | ||
auto const1_gather = engine.allocate_memory(const1_gather_layout); | ||
set_values<int32_t>(const1_gather, {1}); | ||
|
||
layout const_broadcast_layout = layout{ov::PartialShape{}, data_types::i32, format::bfyx}; | ||
auto const_broadcast = engine.allocate_memory(const_broadcast_layout); | ||
set_values<int32_t>(const_broadcast, {1}); | ||
|
||
layout input_l= layout{ov::PartialShape{1, 128}, data_types::i32, format::bfyx}; | ||
auto input_mem = engine.allocate_memory(input_l); | ||
set_values<int32_t>(input_mem, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, | ||
1, 2, 3, 4, 5, 6, 7, 8,}); | ||
|
||
auto input_l_dynamic = layout{ov::PartialShape::dynamic(2), data_types::i32, format::bfyx}; | ||
topology topology(input_layout("input", input_l_dynamic), | ||
data("const1_gather", const1_gather), | ||
data("const_broadcast", const_broadcast), | ||
shape_of("shape_of", input_info("input"), data_types::i32), | ||
gather("gather", input_info("shape_of"), input_info("const1_gather"), 0, 1, ov::Shape({1})), | ||
broadcast("broadcast1", input_info("const_broadcast"), input_info("gather"), {}, ov::op::BroadcastType::NUMPY), | ||
count_nonzero("count_nonzero", input_info("broadcast1")), | ||
gather_nonzero("gather_nonzero", input_info("broadcast1"), input_info("count_nonzero")), | ||
broadcast("broadcast2", input_info("gather_nonzero"), input_info("shape_of"), {}, ov::op::BroadcastType::BIDIRECTIONAL)); | ||
ExecutionConfig config = get_test_default_config(engine); | ||
config.set_property(ov::intel_gpu::allow_new_shape_infer(true)); | ||
|
||
network network(engine, topology, config); | ||
network.set_input_data("input", input_mem); | ||
std::map<primitive_id, network_output> outputs; | ||
OV_ASSERT_NO_THROW(outputs = network.execute()); | ||
} | ||
} // update_shape_test |