fixed the DO test

This commit is contained in:
myshevts 2021-11-24 11:47:24 +03:00
parent c0adce8c77
commit ff72398593
2 changed files with 16 additions and 10 deletions

View File

@ -12,4 +12,7 @@ TEST_P(DetectionOutputLayerTest, CompareWithRefs) {
Run();
};
TEST_P(DetectionOutputLayerTestWithAutoBatching, CompareWithRefs) {
Run();
};
} // namespace LayerTestsDefinitions

View File

@ -27,6 +27,10 @@ std::string DetectionOutputLayerTest::getTestCaseName(const testing::TestParamIn
inShapes.resize(3);
}
for (size_t i = 0; i < inShapes.size(); i++) {
inShapes[i][0] = batch;
}
std::ostringstream result;
result << "IS = { ";
result << "LOC=" << CommonTestUtils::vec2str(inShapes[0]) << "_";
@ -144,7 +148,6 @@ void DetectionOutputLayerTest::SetUp() {
auto params = ngraph::builder::makeParams(ngraph::element::f32, inShapes);
auto paramOuts = ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes<ngraph::opset3::Parameter>(params));
auto detOut = ngraph::builder::makeDetectionOutput(paramOuts, attrs);
ngraph::ResultVector results{std::make_shared<ngraph::opset3::Result>(detOut)};
function = std::make_shared<ngraph::Function>(results, params, "DetectionOutput");
@ -158,10 +161,9 @@ void DetectionOutputLayerTestWithAutoBatching::SetUp() {
DetectionOutputAttributes commonAttrs;
ParamsWhichSizeDepends specificAttrs;
size_t batch;
std::string device;
std::tie(commonAttrs, specificAttrs, batch, attrs.objectness_score, targetDevice) = this->GetParam();
//creating the Auto-batching device with the specific batch size
targetDevice = std::string(CommonTestUtils::DEVICE_BATCH) + ":" + device + "(" + std::to_string(batch) + ")";
targetDevice = std::string(CommonTestUtils::DEVICE_BATCH) + ":" + targetDevice + "(" + std::to_string(batch) + ")";
std::tie(attrs.num_classes, attrs.background_label_id, attrs.top_k, attrs.keep_top_k, attrs.code_type, attrs.nms_threshold, attrs.confidence_threshold,
attrs.clip_after_nms, attrs.clip_before_nms, attrs.decrease_label_id) = commonAttrs;
@ -174,18 +176,19 @@ void DetectionOutputLayerTestWithAutoBatching::SetUp() {
inShapes.resize(3);
}
for (size_t i = 0; i < inShapes.size(); i++) {
inShapes[i][0] = 1; //auto-batching will do the batching transparently
}
// adding Eltwise so that we can tests Auto-Batching's HETERO code-path that splits the DetectionOutput and the rest of the network
auto params = ngraph::builder::makeParams(ngraph::element::f32, inShapes);
auto paramOuts = ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes<ngraph::opset3::Parameter>(params));
// no-op with Eltwise that adds zeros
// (so that we can tests Auto-Batching's HETERO code-path that splits the DetectionOutput and the rest of the network)
ngraph::OutputVector outs;
for (int i = 0; i < inShapes.size(); i++) {
auto shape = inShapes[i];
auto memory_constant = ngraph::builder::makeConstant<float>(ngraph::element::f32, shape,
std::vector<float>(0, ngraph::shape_size(shape)));
auto values = std::make_shared<ngraph::opset5::ReadValue>(memory_constant, "memory");
auto add = ngraph::builder::makeEltwise(paramOuts[i], values, ngraph::helpers::EltwiseTypes::ADD);
auto p = std::make_shared<ngraph::opset3::Parameter>(ngraph::element::f32, ngraph::Shape{shape});
auto add = ngraph::builder::makeEltwise(paramOuts[i], p , ngraph::helpers::EltwiseTypes::ADD);
params.push_back(p);
outs.push_back(add->output(0));
}
auto detOut = ngraph::builder::makeDetectionOutput(outs, attrs);