Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
6b305f8
Runtime. ICompiledModel. Added a check or a batch dimension size and …
DannyVlasenko May 1, 2024
cd48b4f
Runtime. ICompiledModel. Changed the behavior of the Batch Size check…
DannyVlasenko May 6, 2024
df86ec6
Runtime. ICompiledModel. Additional SetBatch tests
DannyVlasenko May 6, 2024
8e6e896
Clang format fixes
DannyVlasenko May 7, 2024
723c0b7
InferenceTests. CompiledModel. Removed redundant test
DannyVlasenko May 21, 2024
6325c0c
Merge branch 'master' into 24243_trap_divide_error_in_GPU_plugin_for_…
DannyVlasenko May 21, 2024
12d5f11
Whitespace differenceMoved the check for BS=0 from ICompiledModel con…
DannyVlasenko May 22, 2024
a8b3edf
Merge branch 'master' into 24243_trap_divide_error_in_GPU_plugin_for_…
DannyVlasenko May 22, 2024
be1d461
Merge branch 'master' into 24243_trap_divide_error_in_GPU_plugin_for_…
DannyVlasenko May 22, 2024
dbfea68
Minor fixes after review
DannyVlasenko May 23, 2024
93691db
Merge branch 'master' into 24243_trap_divide_error_in_GPU_plugin_for_…
riverlijunjie May 23, 2024
c46b5eb
Merge branch 'master' into 24243_trap_divide_error_in_GPU_plugin_for_…
mlukasze Jul 17, 2024
c5dfe78
Merge branch 'master' into 24243_trap_divide_error_in_GPU_plugin_for_…
peterchen-intel Jul 21, 2024
a60849e
Merge branch 'master' into 24243_trap_divide_error_in_GPU_plugin_for_…
mlukasze Jul 25, 2024
40b8aa4
Merge branch 'master' into 24243_trap_divide_error_in_GPU_plugin_for_…
mlukasze Jul 29, 2024
21d84d6
Merge branch 'master' into 24243_trap_divide_error_in_GPU_plugin_for_…
mlukasze Jul 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/core/src/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,20 @@ void ov::Model::validate_nodes_and_infer_types() const {
"Model references undeclared Variables: ",
unregistered_variables.str());

for (const auto& input : inputs()) {
const auto& p_shape = input.get_partial_shape();
const auto& layout = ov::layout::get_layout(input);
if (p_shape.rank().is_static() && p_shape.rank() != 0 && ov::layout::has_batch(layout)) {
const auto batch_idx = ov::layout::batch_idx(layout);
const auto& batch_dim = p_shape[batch_idx];
OPENVINO_ASSERT(batch_dim.is_dynamic() || batch_dim.get_length() > 0,
"Batch size must be a positive value for input '",
input,
"', but has got: ",
batch_dim.get_length());
}
}

for (const auto& output : outputs()) {
OPENVINO_ASSERT(ov::layout::utils::is_compatible(ov::layout::get_layout(output), output.get_partial_shape()),
"Result '",
Expand Down
17 changes: 17 additions & 0 deletions src/core/tests/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2297,3 +2297,20 @@ TEST(model, create_model) {
EXPECT_THROW(ov::Model(ov::ResultVector{}, {}, {}, {nullptr}, ""), ov::Exception);
EXPECT_THROW(ov::Model(ov::OutputVector{ov::Output<ov::Node>{nullptr, 0}}, {}, {}, {}, ""), ov::Exception);
}

TEST(model, batch_size_zero) {
OV_EXPECT_THROW_HAS_SUBSTRING(bs_utils::create_n_inputs(ov::element::f32, {{0, 3, 16, 16}}, {"NCHW"}),
ov::Exception,
"Batch size must be a positive value for input 'opset1::Parameter input0");
OV_EXPECT_THROW_HAS_SUBSTRING(
bs_utils::create_n_inputs(ov::element::f32, {{1, 3, 16, 16}, {0, 3, 16, 16}}, {"NCHW", "NCHW"}),
ov::Exception,
"Batch size must be a positive value for input 'opset1::Parameter input1");
OV_EXPECT_THROW_HAS_SUBSTRING(
bs_utils::create_n_inputs(ov::element::f32, {{1, 3, 16, 16}}, {"NCHW"})->reshape({0, 3, 16, 16}),
ov::Exception,
"Batch size must be a positive value for input 'opset1::Parameter input0");
OV_EXPECT_THROW_HAS_SUBSTRING(set_batch(bs_utils::create_n_inputs(ov::element::f32, {{1, 3, 16, 16}}, {"NCHW"}), 0),
ov::Exception,
"Batch size must be a positive value for input 'opset1::Parameter input0");
}