This commit is contained in:
panhaiqi
2023-09-12 15:59:24 +08:00
parent 5657604f63
commit ff3f8d56d5

View File

@@ -13,6 +13,7 @@
#include "common_test_utils/ov_test_utils.hpp"
#include "functional_test_utils/plugin_cache.hpp"
#include "openvino/runtime/tensor.hpp"
#include "properties.hpp"
namespace ov {
namespace test {
@@ -633,6 +634,88 @@ TEST_P(OVAutoExecutableNetworkTest, AutoNotImplementedSetConfigToExecNet) {
EXPECT_ANY_THROW(execNet.set_property(config));
}
TEST_P(OVCompiledModelBaseTest, GetConfigThrow) { //multi and hetero failed
ov::Core ie = createCoreWithTemplate();
std::shared_ptr<ov::Model> model = ngraph::builder::subgraph::makeSingleConcatWithConstant();
auto compiled_model = ie.compile_model(model, target_device);
ASSERT_THROW(compiled_model.get_property("unsupported_property"), ov::Exception);
}
TEST_P(OVCompiledModelBaseTest, GetMetricNoThrow_SUPPORTED_CONFIG_KEYS) {
ov::Core ie = createCoreWithTemplate();
std::shared_ptr<ov::Model> simpleNetwork = ngraph::builder::subgraph::makeSingleConcatWithConstant();
auto compiled_model = ie.compile_model(simpleNetwork, target_device);
std::vector<ov::PropertyName> supported_properties;
OV_ASSERT_NO_THROW(supported_properties = compiled_model.get_property(ov::supported_properties));
std::cout << "Supported RW keys: " << std::endl;
for (auto&& conf : supported_properties) {
if (conf.is_mutable()) {
std::cout << conf << std::endl;
ASSERT_LT(0, conf.size());
} else {
std::cout << conf << std::endl;
ASSERT_LT(0, conf.size());
}
}
std::cout << "Supported RO keys: " << std::endl;
for (auto&& conf : supported_properties) {
if (!conf.is_mutable()) {
std::cout << conf << std::endl;
ASSERT_LT(0, conf.size());
}
}
ASSERT_LE(0, supported_properties.size());
ASSERT_EXEC_METRIC_SUPPORTED(ov::supported_properties);
}
TEST_P(OVCompiledModelBaseTest, GetMetricNoThrow_NETWORK_NAME) { //MULTI and HETERO failed
ov::Core ie = createCoreWithTemplate();
std::shared_ptr<ov::Model> simpleNetwork = ngraph::builder::subgraph::makeSingleConcatWithConstant();
auto compiled_model = ie.compile_model(simpleNetwork, target_device);
std::string model_name;
OV_ASSERT_NO_THROW(model_name = compiled_model.get_property(ov::model_name));
std::cout << "Compiled model name: " << std::endl << model_name << std::endl;
ASSERT_EQ(simpleNetwork->get_friendly_name(), model_name);
ASSERT_EXEC_METRIC_SUPPORTED(ov::model_name);
}
TEST_P(OVCompiledModelBaseTest, GetMetricNoThrow_OPTIMAL_NUMBER_OF_INFER_REQUESTS) {
ov::Core ie = createCoreWithTemplate();
std::shared_ptr<ov::Model> simpleNetwork = ngraph::builder::subgraph::makeSingleConcatWithConstant();
auto compiled_model = ie.compile_model(simpleNetwork, target_device);
unsigned int value = 0;
OV_ASSERT_NO_THROW(value = compiled_model.get_property(ov::optimal_number_of_infer_requests));
std::cout << "Optimal number of Inference Requests: " << value << std::endl;
ASSERT_GE(value, 1u);
ASSERT_EXEC_METRIC_SUPPORTED(ov::optimal_number_of_infer_requests);
}
TEST_P(OVCompiledModelBaseTest, GetConfigNoThrow) {
ov::Core ie = createCoreWithTemplate();
std::shared_ptr<ov::Model> simpleNetwork = ngraph::builder::subgraph::makeSingleConcatWithConstant();
auto compiled_model = ie.compile_model(simpleNetwork, target_device);
std::vector<ov::PropertyName> property_names;
OV_ASSERT_NO_THROW(property_names = compiled_model.get_property(ov::supported_properties));
for (auto&& property : property_names) {
ov::Any defaultValue;
OV_ASSERT_NO_THROW(defaultValue = compiled_model.get_property(property));
ASSERT_FALSE(defaultValue.empty());
}
}
} // namespace behavior
} // namespace test
} // namespace ov