Update Model::reshape to rethrow currently handled exception (#9723)

* Update Model::reshape to rethrow the currently handled exception

* Set expected type of exception in TestInvalidReshape
This commit is contained in:
Katarzyna Mitrus 2022-01-18 09:49:02 +01:00 committed by GitHub
parent 89f4a569d5
commit 18309852ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -877,10 +877,10 @@ void ov::Model::reshape(const std::map<ov::Output<ov::Node>, ov::PartialShape>&
ssr_manager.run_passes(shared_from_this());
reshape_only(new_param_shapes);
} catch (std::exception& ex) {
} catch (...) {
// restore shapes to original ones
reshape_only(original_input_shapes);
throw ex;
throw;
}
}

View File

@ -741,7 +741,7 @@ TEST(model_reshape, TestInvalidReshape) {
f = std::make_shared<ov::Model>(ov::OutputVector{reshape}, ov::ParameterVector{input});
}
EXPECT_ANY_THROW(f->reshape({{"tensor", ov::Shape({4})}}));
EXPECT_THROW(f->reshape({{"tensor", ov::Shape({4})}}), ov::Exception);
auto param = f->get_parameters().front();
EXPECT_EQ(param->get_output_shape(0), ov::Shape({1, 1000, 4}));