CVS-44774: Fixed preprocessing for template plugin (#4118)
* Fixed preprocessing for template plugin * Added more tests instances * Split common transformation to smaller ones which can be used by plugins * Moved preprocessing transformation to Plugin API * Added PreprocessConversionTest tests * Disabled tests on GPU: CVS-51764 * Disabled some tests on VPU and TEMPLATE * Support for input layout conversions in TEMPLATE plugin * Improvements in Template Plugin * Fixed compilation * Fixes * Disables some tests * Fixed compilation on Windows * Fixed docs
This commit is contained in:
@@ -16,6 +16,8 @@ using namespace TemplatePlugin;
|
||||
|
||||
// ! [executable_network:ctor_cnnnetwork]
|
||||
TemplatePlugin::ExecutableNetwork::ExecutableNetwork(const std::shared_ptr<const ngraph::Function>& function,
|
||||
const InferenceEngine::InputsDataMap& inputInfoMap,
|
||||
const InferenceEngine::OutputsDataMap& outputsInfoMap,
|
||||
const Configuration& cfg,
|
||||
const Plugin::Ptr& plugin) :
|
||||
InferenceEngine::ExecutableNetworkThreadSafeDefault(nullptr, nullptr), // Disable default threads creation
|
||||
@@ -25,14 +27,14 @@ TemplatePlugin::ExecutableNetwork::ExecutableNetwork(const std::shared_ptr<const
|
||||
// you should select proper device based on KEY_DEVICE_ID or automatic behavior
|
||||
// In this case, _waitExecutor should also be created per device.
|
||||
try {
|
||||
CompileNetwork(function);
|
||||
CompileNetwork(function, inputInfoMap, outputsInfoMap);
|
||||
InitExecutor(); // creates thread-based executor using for async requests
|
||||
} catch (const InferenceEngine::Exception&) {
|
||||
throw;
|
||||
} catch (const std::exception & e) {
|
||||
IE_THROW() << "Standard exception from compilation library: " << e.what();
|
||||
IE_THROW(Unexpected) << "Standard exception from compilation library: " << e.what();
|
||||
} catch (...) {
|
||||
IE_THROW() << "Generic exception is thrown";
|
||||
IE_THROW(Unexpected) << "Generic exception is thrown";
|
||||
}
|
||||
}
|
||||
// ! [executable_network:ctor_cnnnetwork]
|
||||
@@ -64,6 +66,8 @@ TemplatePlugin::ExecutableNetwork::ExecutableNetwork(std::istream & model,
|
||||
|
||||
// TODO: implement Import / Export of configuration options and merge with `cfg`
|
||||
// TODO: implement Import / Export of network precisions, layouts, preprocessing info
|
||||
InferenceEngine::InputsDataMap inputInfoMap;
|
||||
InferenceEngine::OutputsDataMap outputInfoMap;
|
||||
|
||||
auto cnnnetwork = _plugin->GetCore()->ReadNetwork(xmlString, std::move(dataBlob));
|
||||
|
||||
@@ -72,27 +76,31 @@ TemplatePlugin::ExecutableNetwork::ExecutableNetwork(std::istream & model,
|
||||
SetPointerToPlugin(_plugin->shared_from_this());
|
||||
|
||||
try {
|
||||
CompileNetwork(cnnnetwork.getFunction());
|
||||
CompileNetwork(cnnnetwork.getFunction(), inputInfoMap, outputInfoMap);
|
||||
InitExecutor(); // creates thread-based executor using for async requests
|
||||
} catch (const InferenceEngine::Exception&) {
|
||||
throw;
|
||||
} catch (const std::exception & e) {
|
||||
IE_THROW() << "Standard exception from compilation library: " << e.what();
|
||||
IE_THROW(Unexpected) << "Standard exception from compilation library: " << e.what();
|
||||
} catch (...) {
|
||||
IE_THROW() << "Generic exception is thrown";
|
||||
IE_THROW(Unexpected) << "Generic exception is thrown";
|
||||
}
|
||||
}
|
||||
// ! [executable_network:ctor_import_stream]
|
||||
|
||||
// ! [executable_network:map_graph]
|
||||
// forward declaration
|
||||
std::shared_ptr<ngraph::Function> TransformNetwork(const std::shared_ptr<const ngraph::Function>& function);
|
||||
std::shared_ptr<ngraph::Function> TransformNetwork(const std::shared_ptr<const ngraph::Function>& function,
|
||||
const InferenceEngine::InputsDataMap & inputInfoMap,
|
||||
const InferenceEngine::OutputsDataMap& outputsInfoMap);
|
||||
|
||||
void TemplatePlugin::ExecutableNetwork::CompileNetwork(const std::shared_ptr<const ngraph::Function>& function) {
|
||||
void TemplatePlugin::ExecutableNetwork::CompileNetwork(const std::shared_ptr<const ngraph::Function>& function,
|
||||
const InferenceEngine::InputsDataMap & inputInfoMap,
|
||||
const InferenceEngine::OutputsDataMap& outputsInfoMap) {
|
||||
// TODO: perform actual graph compilation / mapping to backend graph representation / kernels
|
||||
|
||||
// apply plugins transformations
|
||||
_function = TransformNetwork(function);
|
||||
_function = TransformNetwork(function, inputInfoMap, outputsInfoMap);
|
||||
|
||||
// Generate backend specific blob mappings. For example Inference Engine uses not ngraph::Result nodes friendly name
|
||||
// as inference request output names but the name of the layer before.
|
||||
|
||||
Reference in New Issue
Block a user