[apiConformance] Refactor io_tensor.cpp (#15680)

This commit is contained in:
Sofya Balandina 2023-02-22 13:42:07 +00:00 committed by GitHub
parent 877018bab6
commit 5251133202
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,12 @@ void OVInferRequestIOTensorTest::SetUp() {
// Skip test according to plugin specific disabledTestPatterns() (if any)
SKIP_IF_CURRENT_TEST_IS_DISABLED()
OVInferRequestTests::SetUp();
req = execNet.create_infer_request();
try {
req = execNet.create_infer_request();
} catch (const std::exception& ex) {
FAIL() << "Can't Create Infer Requiest in SetUp \nException [" << ex.what() << "]"
<< std::endl;
}
input = execNet.input();
output = execNet.output();
}
@ -32,11 +37,6 @@ void OVInferRequestIOTensorTest::TearDown() {
OVInferRequestTests::TearDown();
}
TEST_P(OVInferRequestIOTensorTest, Cancreate_infer_request) {
ov::InferRequest req;
OV_ASSERT_NO_THROW(req = execNet.create_infer_request());
}
TEST_P(OVInferRequestIOTensorTest, failToSetNullptrForInput) {
ASSERT_THROW(req.set_tensor(input, {}), ov::Exception);
}
@ -46,7 +46,7 @@ TEST_P(OVInferRequestIOTensorTest, failToSetNullptrForOutput) {
ASSERT_THROW(req.set_tensor(output, {}), ov::Exception);
}
TEST_P(OVInferRequestIOTensorTest, getAfterSetInputDoNotChangeInput) {
TEST_P(OVInferRequestIOTensorTest, canSetAndGetInput) {
auto tensor = utils::create_and_fill_tensor(input.get_element_type(), input.get_shape());
OV_ASSERT_NO_THROW(req.set_tensor(input, tensor));
ov::Tensor actual_tensor;
@ -59,7 +59,7 @@ TEST_P(OVInferRequestIOTensorTest, getAfterSetInputDoNotChangeInput) {
ASSERT_EQ(input.get_shape(), actual_tensor.get_shape());
}
TEST_P(OVInferRequestIOTensorTest, getAfterSetInputDoNotChangeOutput) {
TEST_P(OVInferRequestIOTensorTest, canSetAndGetOutput) {
auto tensor = utils::create_and_fill_tensor(output.get_element_type(), output.get_shape());
req.set_tensor(output, tensor);
auto actual_tensor = req.get_tensor(output);
@ -133,22 +133,6 @@ TEST_P(OVInferRequestIOTensorTest, secondCallGetOutputAfterInferSync) {
ASSERT_EQ(tensor1.data(), tensor2.data());
}
TEST_P(OVInferRequestIOTensorTest, canSetInputTensorForInferRequest) {
auto input_tensor = utils::create_and_fill_tensor(input.get_element_type(), input.get_shape());
OV_ASSERT_NO_THROW(req.set_tensor(input, input_tensor));
ov::Tensor actual_tensor;
OV_ASSERT_NO_THROW(actual_tensor = req.get_tensor(input));
ASSERT_EQ(input_tensor.data(), actual_tensor.data());
}
TEST_P(OVInferRequestIOTensorTest, canSetOutputBlobForInferRequest) {
auto output_tensor = utils::create_and_fill_tensor(output.get_element_type(), output.get_shape());
OV_ASSERT_NO_THROW(req.set_tensor(output, output_tensor));
ov::Tensor actual_tensor;
OV_ASSERT_NO_THROW(actual_tensor = req.get_tensor(output));
ASSERT_EQ(output_tensor.data(), actual_tensor.data());
}
TEST_P(OVInferRequestIOTensorTest, canInferWithSetInOutBlobs) {
auto input_tensor = utils::create_and_fill_tensor(input.get_element_type(), input.get_shape());
OV_ASSERT_NO_THROW(req.set_tensor(input, input_tensor));