Added test-case with MatMul to caching tests

This commit is contained in:
Vladislav Golubev 2021-11-02 10:53:52 +03:00
parent 95bc22f065
commit eb69888896
2 changed files with 20 additions and 0 deletions

View File

@ -109,6 +109,9 @@ std::vector<nGraphFunctionWithName> LoadNetworkCacheTestBase::getStandardFunctio
res.push_back(nGraphFunctionWithName {
inputShapeWrapper(ngraph::builder::subgraph::makeReadConcatSplitAssign, {1, 1, 2, 4}),
"ReadConcatSplitAssign"});
res.push_back(nGraphFunctionWithName{
inputShapeWrapper(ngraph::builder::subgraph::makeMatMulBias, {1, 3, 24, 24}),
"MatMulBias" });
return res;
}

View File

@ -550,6 +550,23 @@ inline std::shared_ptr<ngraph::Function> makeReadConcatSplitAssign(std::vector<s
fn_ptr->set_friendly_name("ReadConcatSplitAssign");
return fn_ptr;
}
inline std::shared_ptr<ngraph::Function> makeMatMulBias(std::vector<size_t> inputShape = { 1, 3, 24, 24 },
ngraph::element::Type type = ngraph::element::Type_t::f32) {
auto parameter = ngraph::builder::makeParams(type, { inputShape });
parameter[0]->set_friendly_name("parameter");
auto weights = ngraph::opset1::Constant::create(type, ngraph::Shape{ 24, 24 }, { 1 });
auto biases = ngraph::opset1::Constant::create(type, ngraph::Shape{ 1, 24 }, { 1 });
auto matmul = std::make_shared<opset1::MatMul>(parameter[0], weights);
matmul->set_friendly_name("matmul");
auto add = std::make_shared<opset1::Add>(matmul, biases);
add->set_friendly_name("add");
auto result = std::make_shared<ngraph::opset1::Result>(add);
result->set_friendly_name("result");
std::shared_ptr<ngraph::Function> fn_ptr = std::make_shared<ngraph::Function>(ngraph::ResultVector{ result }, ngraph::ParameterVector{ parameter });
fn_ptr->set_friendly_name("MatMulBias");
return fn_ptr;
}
} // namespace subgraph
} // namespace builder
} // namespace ngraph