}
InferenceEnginePython::IENetwork::IENetwork(const std::string &model, const std::string &weights) {
- IE_SUPPRESS_DEPRECATED_START
- InferenceEngine::CNNNetReader net_reader;
- net_reader.ReadNetwork(model);
- net_reader.ReadWeights(weights);
- auto net = net_reader.getNetwork();
- IE_SUPPRESS_DEPRECATED_END
+ InferenceEngine::Core reader;
+ auto net = reader.ReadNetwork(model, weights);
actual = std::make_shared<InferenceEngine::CNNNetwork>(net);
name = actual->getName();
batch_size = actual->getBatchSize();
void
InferenceEnginePython::IENetwork::load_from_buffer(const char *xml, size_t xml_size, uint8_t *bin, size_t bin_size) {
- IE_SUPPRESS_DEPRECATED_START
- InferenceEngine::CNNNetReader net_reader;
- net_reader.ReadNetwork(xml, xml_size);
+ InferenceEngine::Core reader;
InferenceEngine::TensorDesc tensorDesc(InferenceEngine::Precision::U8, { bin_size }, InferenceEngine::Layout::C);
auto weights_blob = InferenceEngine::make_shared_blob<uint8_t>(tensorDesc, bin, bin_size);
- net_reader.SetWeights(weights_blob);
- name = net_reader.getName();
- auto net = net_reader.getNetwork();
- IE_SUPPRESS_DEPRECATED_END
+ auto net = reader.ReadNetwork(std::string(xml, xml + xml_size), weights_blob);
+ name = net.getName();
actual = std::make_shared<InferenceEngine::CNNNetwork>(net);
batch_size = actual->getBatchSize();
}
+++ /dev/null
-// Copyright (C) 2018-2020 Intel Corporation
-// SPDX-License-Identifier: Apache-2.0
-//
-
-/**
- * @brief This is a header file for the Network reader class (wrapper) used to build networks from a given IR
- *
- * @file ie_cnn_net_reader.h
- */
-#pragma once
-
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "details/ie_exception_conversion.hpp"
-#include "details/os/os_filesystem.hpp"
-#include "ie_blob.h"
-#include "cpp/ie_cnn_network.h"
-#include "ie_common.h"
-#include "ie_icnn_net_reader.h"
-
-namespace InferenceEngine {
-/**
- * @deprecated Use InferenceEngine::Core::ReadNetwork methods. This API will be removed in 2021.1
- * @brief This is a wrapper class used to build and parse a network from the given IR.
- *
- * All the methods here can throw exceptions.
- */
-IE_SUPPRESS_DEPRECATED_START
-class INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::Core::ReadNetwork methods. This API will be removed in 2021.1")
- CNNNetReader {
-public:
- /**
- * @brief A smart pointer to this class
- */
- using Ptr = std::shared_ptr<CNNNetReader>;
-
- /**
- * @brief A default constructor
- */
- CNNNetReader(): actual(InferenceEngine::CreateCNNNetReaderPtr()) {
- if (actual == nullptr) {
- THROW_IE_EXCEPTION << "CNNNetReader was not initialized.";
- }
- }
-
-#ifdef ENABLE_UNICODE_PATH_SUPPORT
- /**
- * @brief Resolve wstring path then call original ReadNetwork
- *
- * Wraps ICNNNetReader::ReadNetwork
- *
- * @param filepath The full path to the .xml file of the IR
- */
- void ReadNetwork(const std::wstring& filepath) {
- CALL_STATUS_FNC(ReadNetwork, details::wStringtoMBCSstringChar(filepath).c_str());
- }
-#endif
-
- /**
- * @copybrief ICNNNetReader::ReadNetwork
- *
- * Wraps ICNNNetReader::ReadNetwork
- *
- * @param filepath The full path to the .xml file of the IR
- */
- void ReadNetwork(const std::string& filepath) {
- CALL_STATUS_FNC(ReadNetwork, filepath.c_str());
- }
-
- /**
- * @copybrief ICNNNetReader::ReadNetwork(const void*, size_t, ResponseDesc*)
- *
- * Wraps ICNNNetReader::ReadNetwork(const void*, size_t, ResponseDesc*)
- *
- * @param model Pointer to a char array with the IR
- * @param size Size of the char array in bytes
- */
- void ReadNetwork(const void* model, size_t size) {
- CALL_STATUS_FNC(ReadNetwork, model, size);
- }
-
- /**
- * @copybrief ICNNNetReader::SetWeights
- *
- * Wraps ICNNNetReader::SetWeights
- *
- * @param weights Blob of bytes that holds all the IR binary data
- */
- void SetWeights(const TBlob<uint8_t>::Ptr& weights) {
- CALL_STATUS_FNC(SetWeights, weights);
- }
-
-#ifdef ENABLE_UNICODE_PATH_SUPPORT
- /**
- * @brief Resolve wstring path then call original ReadWeights
- *
- * ICNNNetReader::ReadWeights
- *
- * @param filepath Full path to the .bin file
- */
- void ReadWeights(const std::wstring& filepath) {
- CALL_STATUS_FNC(ReadWeights, details::wStringtoMBCSstringChar(filepath).c_str());
- }
-#endif
-
- /**
- * @copybrief ICNNNetReader::ReadWeights
- *
- * Wraps ICNNNetReader::ReadWeights
- *
- * @param filepath Full path to the .bin file
- */
- void ReadWeights(const std::string& filepath) {
- CALL_STATUS_FNC(ReadWeights, filepath.c_str());
- }
-
- /**
- * @brief Gets a copy of built network object
- *
- * @return A copy of the CNNNetwork object to be loaded
- */
- CNNNetwork getNetwork() {
- // network obj are to be updated upon this call
- if (network.get() == nullptr) {
- try {
- network.reset(new CNNNetwork(actual));
- } catch (...) {
- THROW_IE_EXCEPTION << "Could not allocate memory";
- }
- }
- return *network.get();
- }
-
- /**
- * @copybrief ICNNNetReader::isParseSuccess
- *
- * Wraps ICNNNetReader::isParseSuccess
- *
- * @return true if a parse is successful, false otherwise
- */
- bool isParseSuccess() const {
- CALL_FNC_NO_ARGS(isParseSuccess);
- }
-
- /**
- * @copybrief ICNNNetReader::getDescription
- *
- * Wraps ICNNNetReader::getDescription
- *
- * @return StatusCode that indicates the network status
- */
- std::string getDescription() const {
- CALL_STATUS_FNC_NO_ARGS(getDescription);
- return resp.msg;
- }
-
- /**
- * @copybrief ICNNNetReader::getName
- *
- * Wraps ICNNNetReader::getName
- *
- * @return String
- */
- std::string getName() const {
- char name[64];
- CALL_STATUS_FNC(getName, name, sizeof(name) / sizeof(*name));
- return name;
- }
-
- /**
- * @copybrief ICNNNetReader::getVersion
- *
- * Wraps ICNNNetReader::getVersion
- *
- * @return IR version number: 1 or 2
- */
- int getVersion() const {
- CALL_FNC_NO_ARGS(getVersion);
- }
-
-private:
- CNNNetReaderPtr actual;
- std::shared_ptr<CNNNetwork> network;
-};
-IE_SUPPRESS_DEPRECATED_END
-} // namespace InferenceEngine
*/
#pragma once
-#include <ie_icnn_net_reader.h>
-
#include <details/ie_cnn_network_iterator.hpp>
#include <details/ie_exception_conversion.hpp>
#include <ie_icnn_network.hpp>
explicit CNNNetwork(const std::shared_ptr<const ngraph::Function>& network);
/**
- * @brief A constructor from ICNNNetReader object
- *
- * @param reader Pointer to the ICNNNetReader object
- */
- IE_SUPPRESS_DEPRECATED_START
- explicit CNNNetwork(CNNNetReaderPtr reader_): reader(reader_) {
- if (reader == nullptr) {
- THROW_IE_EXCEPTION << "ICNNNetReader was not initialized.";
- }
- if ((actual = reader->getNetwork(nullptr)) == nullptr) {
- THROW_IE_EXCEPTION << "CNNNetwork was not initialized.";
- }
- }
- IE_SUPPRESS_DEPRECATED_END
-
- /**
* @brief A destructor
*/
virtual ~CNNNetwork() {}
protected:
/**
- * @brief Reader extra reference, might be nullptr
- */
- IE_SUPPRESS_DEPRECATED_START
- CNNNetReaderPtr reader;
- IE_SUPPRESS_DEPRECATED_END
- /**
* @brief Network extra interface, might be nullptr
*/
std::shared_ptr<ICNNNetwork> network;
+++ /dev/null
-// Copyright (C) 2018-2020 Intel Corporation
-// SPDX-License-Identifier: Apache-2.0
-//
-
-/**
- * @brief A header file that provides interface for network reader that is used to build networks from a given IR
- *
- * @file ie_icnn_net_reader.h
- */
-#pragma once
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "details/ie_no_copy.hpp"
-#include "details/ie_so_pointer.hpp"
-#include "ie_api.h"
-#include "ie_blob.h"
-#include "ie_common.h"
-#include "ie_icnn_network.hpp"
-
-namespace InferenceEngine {
-/**
- * @deprecated Use InferenceEngine::Core::ReadNetwork methods. This API will be removed in 2021.1
- * @brief This class is the main interface to build and parse a network from a given IR
- *
- * All methods here do not throw exceptions and return a StatusCode and ResponseDesc object.
- * Alternatively, to use methods that throw exceptions, refer to the CNNNetReader wrapper class.
- */
-class INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::Core::ReadNetwork methods. This API will be removed in 2021.1")
- ICNNNetReader : public details::IRelease {
-public:
- /**
- * @brief Parses the topology part of the IR (.xml)
- *
- * This method can be called once only to read network. If you need to read another network instance then create new
- * reader instance.
- *
- * @param filepath The full path to the .xml file of the IR
- * @param resp Response message
- * @return Result code
- */
- virtual StatusCode ReadNetwork(const char* filepath, ResponseDesc* resp) noexcept = 0;
-
- /**
- * @brief Parses the topology part of the IR (.xml) given the xml as a buffer
- *
- * This method can be called once only to read network. If you need to read another network instance then create new
- * reader instance.
- *
- * @param model Pointer to a char array with the IR
- * @param resp Response message
- * @param size Size of the char array in bytes
- * @return Result code
- */
- virtual StatusCode ReadNetwork(const void* model, size_t size, ResponseDesc* resp) noexcept = 0;
-
- /**
- * @brief Sets the weights buffer (.bin part) from the IR.
- *
- * Weights Blob must always be of bytes - the casting to precision is done per-layer to support mixed
- * networks and to ease of use.
- * This method can be called more than once to reflect updates in the .bin.
- *
- * @param weights Blob of bytes that holds all the IR binary data
- * @param resp Response message
- * @return Result code
- */
- virtual StatusCode SetWeights(const TBlob<uint8_t>::Ptr& weights, ResponseDesc* resp) noexcept = 0;
-
- /**
- * @brief Loads and sets the weights buffer directly from the IR .bin file.
- *
- * This method can be called more than once to reflect updates in the .bin.
- *
- * @param filepath Full path to the .bin file
- * @param resp Response message
- * @return Result code
- */
- virtual StatusCode ReadWeights(const char* filepath, ResponseDesc* resp) noexcept = 0;
-
- /**
- * @brief Returns a pointer to the built network
- *
- * @param resp Response message
- * @return A pointer to a network
- */
- virtual ICNNNetwork* getNetwork(ResponseDesc* resp) noexcept = 0;
-
- /**
- * @brief Retrieves the last building status
- * @param resp Response message
- * @return `True` in case of parsing is successful, `false` otherwise.
- */
- virtual bool isParseSuccess(ResponseDesc* resp) noexcept = 0;
-
- /**
- * @brief Retrieves the last building failure message if failed
- *
- * @param resp Response message
- * @return StatusCode that indicates the network status
- */
- virtual StatusCode getDescription(ResponseDesc* resp) noexcept = 0;
-
- /**
- * @brief Gets network name
- *
- * @param name Pointer to preallocated buffer that receives network name
- * @param len Length of the preallocated buffer, network name will be trimmed by this lenght
- * @param resp Response message
- * @return Result code
- */
- virtual StatusCode getName(char* name, size_t len, ResponseDesc* resp) noexcept = 0;
-
- /**
- * @brief Returns a version of IR
- *
- * @param resp Response message
- * @return IR version number: 1 or 2
- */
- virtual int getVersion(ResponseDesc* resp) noexcept = 0;
-
- virtual void addExtensions(const std::vector<InferenceEngine::IExtensionPtr>& ext) = 0;
-
- /**
- * @brief A virtual destructor.
- */
- ~ICNNNetReader() override = default;
-};
-
-IE_SUPPRESS_DEPRECATED_START
-
-namespace details {
-
-/**
- * @brief This class defines the name of the fabric for creating an ICNNNetReader object in DLL
- */
-template<>
-class SOCreatorTrait<ICNNNetReader> {
-public:
- /**
- * @brief A name of the fabric for creating ICNNNetReader object in DLL
- */
- static constexpr auto name = "CreateICNNNetReader";
-};
-
-} // namespace details
-
-/**
- * @brief A C++ helper to work with objects created by the IR readers plugin.
- * Implements different interfaces.
- */
-using CNNNetReaderPtr = InferenceEngine::details::SOPointer<ICNNNetReader, InferenceEngine::details::SharedObjectLoader>;
-
-/**
- * @brief Creates a CNNNetReader instance
- * @return An object that implements the ICNNNetReader interface
- */
-INFERENCE_ENGINE_API_CPP(CNNNetReaderPtr) CreateCNNNetReaderPtr() noexcept;
-
-IE_SUPPRESS_DEPRECATED_END
-
-} // namespace InferenceEngine
#include <ie_api.h>
#include <ie_blob.h>
#include <ie_layers.h>
-#include <cpp/ie_cnn_net_reader.h>
#include <cpp/ie_executable_network.hpp>
#include <ie_core.hpp>
#include <ie_icnn_network.hpp>
#include <mutex>
#include <ngraph/opsets/opset.hpp>
-#include "cpp/ie_cnn_net_reader.h"
#include "ie_plugin_cpp.hpp"
#include "cpp_interfaces/base/ie_plugin_base.hpp"
#include "details/ie_exception_conversion.hpp"
} // namespace
-CNNNetReaderPtr CreateCNNNetReaderPtr() noexcept {
- auto loader = createCnnReaderLoader();
- return CNNNetReaderPtr(loader);
-}
-
IE_SUPPRESS_DEPRECATED_END
DeviceIDParser::DeviceIDParser(const std::string& deviceNameWithID) {
using namespace InferenceEngine;
using namespace InferenceEngine::details;
-IE_SUPPRESS_DEPRECATED_START
CNNNetReaderImpl::CNNNetReaderImpl(const FormatParserCreator::Ptr& _creator)
: parseSuccess(false), _version(0), parserCreator(_creator) {}
std::shared_ptr<IFormatParser> V2FormatParserCreator::create(size_t version) {
return std::make_shared<FormatParser>(version);
}
-
-INFERENCE_PLUGIN_API(InferenceEngine::StatusCode)
-CreateICNNNetReader(ICNNNetReader *& data, ResponseDesc *resp) noexcept {
- data = new CNNNetReaderImpl(std::make_shared<V2FormatParserCreator>());
- return StatusCode::OK;
-}
-
-IE_SUPPRESS_DEPRECATED_END
std::shared_ptr<IFormatParser> create(size_t version) override;
};
-IE_SUPPRESS_DEPRECATED_START
-class INFERENCE_ENGINE_API_CLASS(CNNNetReaderImpl) : public ICNNNetReader {
+class INFERENCE_ENGINE_API_CLASS(CNNNetReaderImpl) {
public:
explicit CNNNetReaderImpl(const FormatParserCreator::Ptr& _creator);
- StatusCode ReadNetwork(const char* filepath, ResponseDesc* resp) noexcept override;
+ StatusCode ReadNetwork(const char* filepath, ResponseDesc* resp) noexcept;
- StatusCode ReadNetwork(const void* model, size_t size, ResponseDesc* resp) noexcept override;
+ StatusCode ReadNetwork(const void* model, size_t size, ResponseDesc* resp) noexcept;
StatusCode ReadNetwork(const pugi::xml_node& root, ResponseDesc* resp);
- StatusCode SetWeights(const TBlob<uint8_t>::Ptr& weights, ResponseDesc* resp) noexcept override;
+ StatusCode SetWeights(const TBlob<uint8_t>::Ptr& weights, ResponseDesc* resp) noexcept;
- StatusCode ReadWeights(const char* filepath, ResponseDesc* resp) noexcept override;
+ StatusCode ReadWeights(const char* filepath, ResponseDesc* resp) noexcept;
- ICNNNetwork* getNetwork(ResponseDesc* resp) noexcept override {
+ ICNNNetwork* getNetwork(ResponseDesc* resp) noexcept {
IE_PROFILING_AUTO_SCOPE(CNNNetReaderImpl::getNetwork)
return network.get();
}
return network;
}
- bool isParseSuccess(ResponseDesc* resp) noexcept override {
+ bool isParseSuccess(ResponseDesc* resp) noexcept {
return parseSuccess;
}
- StatusCode getDescription(ResponseDesc* desc) noexcept override {
+ StatusCode getDescription(ResponseDesc* desc) noexcept {
return DescriptionBuffer(OK, desc) << description;
}
- StatusCode getName(char* name, size_t len, ResponseDesc* resp) noexcept override {
+ StatusCode getName(char* name, size_t len, ResponseDesc* resp) noexcept {
if (len > 0) {
size_t length = std::min(this->name.size(), len - 1); // cut the name if buffer is too small
ie_memcpy(name, len, this->name.c_str(), length);
return OK;
}
- int getVersion(ResponseDesc* resp) noexcept override {
+ int getVersion(ResponseDesc* resp) noexcept {
return _version;
}
- void Release() noexcept override {
+ void Release() noexcept {
delete this;
}
- void addExtensions(const std::vector<InferenceEngine::IExtensionPtr>& ext) override;
+ void addExtensions(const std::vector<InferenceEngine::IExtensionPtr>& ext);
- ~CNNNetReaderImpl() override;
+ ~CNNNetReaderImpl();
private:
std::shared_ptr<InferenceEngine::details::IFormatParser> _parser;
std::vector<InferenceEngine::IExtensionPtr> extensions;
};
-IE_SUPPRESS_DEPRECATED_END
-
} // namespace details
} // namespace InferenceEngine
/**
* @brief This class is the main interface to build and parse a network from a given IR
- *
- * All methods here do not throw exceptions and return a StatusCode and ResponseDesc object.
- * Alternatively, to use methods that throw exceptions, refer to the CNNNetReader wrapper class.
*/
class IRReader: public IReader {
public:
#include <vpu/utils/file_system.hpp>
#include <vpu/model/data_contents/mtcnn_blob_content.hpp>
-#include <cpp/ie_cnn_net_reader.h>
+#include <ie_core.hpp>
#include <vector>
#include <fstream>
// Load network
//
- auto binFileName = fileNameNoExt(fileName) + ".bin";
-
- IE_SUPPRESS_DEPRECATED_START
- ie::CNNNetReader networkReader;
- networkReader.ReadNetwork(fileName);
- networkReader.ReadWeights(binFileName);
-
- auto network = networkReader.getNetwork();
- IE_SUPPRESS_DEPRECATED_END
+ // ticket 30632 : replace with ICore interface
+ InferenceEngine::Core reader;
+ auto network = reader.ReadNetwork(fileName);
//
// Set precision of input/output
bootOneDevice();
ASSERT_EQ(getAmountOfBootedDevices(), 1);
{
- InferenceEnginePluginPtr plugin(make_plugin_name(GetParam().pluginName));
- CNNNetReader reader;
- reader.ReadNetwork(GetParam().model_xml_str.data(), GetParam().model_xml_str.length());
-
- CNNNetwork network = reader.getNetwork();
- ExecutableNetwork ret;
-
- sts = plugin->LoadNetwork(ret, network, {
- {KEY_LOG_LEVEL, LOG_DEBUG},
- {KEY_VPU_MYRIAD_WATCHDOG, NO},
- }, &response);
-
- ASSERT_NE(StatusCode::OK, sts) << response.msg;
+ Core ie;
+ CNNNetwork network = ie.ReadNetwork(GetParam().model_xml_str, Blob::CPtr());
+ ExecutableNetwork net = ie.LoadNetwork(network, GetParam().device,
+ { {KEY_LOG_LEVEL, LOG_DEBUG},
+ {KEY_VPU_MYRIAD_WATCHDOG, NO} });
ASSERT_EQ(getAmountOfBootedDevices(), 1);
}
bootOneDevice();
ASSERT_EQ(getAmountOfBootedDevices(), 1);
{
- InferenceEnginePluginPtr plugin(make_plugin_name(GetParam().pluginName));
- CNNNetReader reader;
- reader.ReadNetwork(GetParam().model_xml_str.data(), GetParam().model_xml_str.length());
-
- CNNNetwork network = reader.getNetwork();
- ExecutableNetwork ret;
-
- sts = plugin->LoadNetwork(ret, network, {
- {KEY_LOG_LEVEL, LOG_DEBUG},
- {KEY_VPU_MYRIAD_WATCHDOG, NO},
- }, &response);
-
- ASSERT_NE(StatusCode::OK, sts) << response.msg;
+ Core ie;
+ CNNNetwork network = ie.ReadNetwork(GetParam().model_xml_str, Blob::CPtr());
+ ExecutableNetwork net = ie.LoadNetwork(network, GetParam().device,
+ { {KEY_LOG_LEVEL, LOG_DEBUG},
+ {KEY_VPU_MYRIAD_WATCHDOG, NO} });
ASSERT_EQ(getAmountOfBootedDevices(), 2);
}
#include <thread>
#include <file_utils.h>
#include "vpu_test_data.hpp"
+#include "functional_test_utils/test_model/test_model.hpp"
#include "helpers/myriad_devices.hpp"
#include <details/ie_exception.hpp>
auto startup_devices = queryDevices();
auto ctime = Time::now();
{
-
InferenceEngine::Core core;
- IE_SUPPRESS_DEPRECATED_START
- CNNNetReader reader;
- reader.ReadNetwork(GetParam().model_xml_str.data(), GetParam().model_xml_str.length());
-
- CNNNetwork network = reader.getNetwork();
- IE_SUPPRESS_DEPRECATED_END
+ auto model = FuncTestUtils::TestModel::convReluNormPoolFcModelFP16;
+ CNNNetwork network = core.ReadNetwork(model.model_xml_str, model.weights_blob);
ASSERT_GE(startup_devices.unbooted, 1);
ExecutableNetwork ret;
ctime = Time::now();
- ASSERT_THROW(ret = core.LoadNetwork(network, GetParam().device, {
- {KEY_LOG_LEVEL, LOG_INFO}}),
- InferenceEngine::details::InferenceEngineException);
+ ret = core.LoadNetwork(network, GetParam().device, {
+ {KEY_LOG_LEVEL, LOG_INFO} });
ASSERT_BOOTED_DEVICES_ONE_MORE();
auto ctime = Time::now();
{
InferenceEngine::Core core;
- IE_SUPPRESS_DEPRECATED_START
- CNNNetReader reader;
- reader.ReadNetwork(GetParam().model_xml_str.data(), GetParam().model_xml_str.length());
-
- CNNNetwork network = reader.getNetwork();
- IE_SUPPRESS_DEPRECATED_END
+ auto model = FuncTestUtils::TestModel::convReluNormPoolFcModelFP16;
+ CNNNetwork network = core.ReadNetwork(model.model_xml_str, model.weights_blob);
ASSERT_GE(startup_devices.unbooted, 1);
ExecutableNetwork ret;
ctime = Time::now();
- ASSERT_THROW(ret = core.LoadNetwork(network, GetParam().device, {
+ ret = core.LoadNetwork(network, GetParam().device, {
{KEY_LOG_LEVEL, LOG_INFO},
- {KEY_VPU_MYRIAD_WATCHDOG, NO}}),
- InferenceEngine::details::InferenceEngineException);
+ {KEY_VPU_MYRIAD_WATCHDOG, NO}});
ASSERT_BOOTED_DEVICES_ONE_MORE();
}
float ConcatWithPoolingTestModel::getThreshold(
- const std::string& pluginName,
+ const std::string& deviceName,
const Precision precision,
LayerTransformation::Params& params) const {
if (params.quantizeOutputs && signedIntervals && shift && (dequantizationIntervalsDifference != 0.f)) {
return 0.0153;
}
- return SingleLayerTestModel::getThreshold(pluginName, precision, params);
+ return SingleLayerTestModel::getThreshold(deviceName, precision, params);
}
#include "cpp_interfaces/interface/ie_internal_plugin_config.hpp"
#include "common/validation.hpp"
#include "tests_common_func.hpp"
-#include <cpp/ie_cnn_net_reader.h>
TBlob<uint8_t>::Ptr SingleLayerTransformationsTest::generateWeights(const CNNNetwork& network) {
std::vector<Blob::Ptr> blobs;
};
}
-std::function<void()> read_network(const std::string &model) {
- return [&] {
- IE_SUPPRESS_DEPRECATED_START
- CNNNetReader netReader;
- netReader.ReadNetwork(model);
- netReader.ReadWeights(fileNameNoExt(model) + ".bin");
- IE_SUPPRESS_DEPRECATED_END
- };
-}
-
-std::function<void()> create_cnnnetwork(const std::string &model) {
+std::function<void()> read_cnnnetwork(const std::string &model) {
return [&] {
Core ie;
CNNNetwork cnnNetwork = ie.ReadNetwork(model);
#include <inference_engine.hpp>
std::function<void()> load_unload_plugin(const std::string &target_device);
-std::function<void()> read_network(const std::string &model);
-std::function<void()> create_cnnnetwork(const std::string &model);
+std::function<void()> read_cnnnetwork(const std::string &model);
std::function<void()> cnnnetwork_reshape_batch_x2(const std::string &model);
std::function<void()> set_input_params(const std::string &model);
std::function<void()> create_exenetwork(const std::string &model, const std::string &target_device);
test_runner(test_params.numthreads, test);
}
-TEST_P(MemLeaksTestSuiteNoDevice, create_cnnnetwork) {
- auto test_params = GetParam();
- auto test = [&] {
- return test_create_cnnnetwork(test_params.model, test_params.numiters);
- };
- test_runner(test_params.numthreads, test);
-}
-
TEST_P(MemLeaksTestSuiteNoDevice, cnnnetwork_reshape_batch_x2) {
auto test_params = GetParam();
auto test = [&] {
TestResult test_read_network(const std::string& model, const int& n) {
log_info("Read network: \"" << model << "\" for " << n << " times");
- return common_test_pipeline(read_network(model), n);
-}
-
-TestResult test_create_cnnnetwork(const std::string& model, const int& n) {
- log_info("Create CNNNetwork from network: \"" << model << "\" for " << n << " times");
- return common_test_pipeline(create_cnnnetwork(model), n);
+ return common_test_pipeline(read_cnnnetwork(model), n);
}
TestResult test_cnnnetwork_reshape_batch_x2(const std::string& model, const int& n) {
// tests_pipelines/tests_pipelines.cpp
TestResult test_load_unload_plugin(const std::string &target_device, const int &n);
TestResult test_read_network(const std::string &model, const int &n);
-TestResult test_create_cnnnetwork(const std::string &model, const int &n);
TestResult test_cnnnetwork_reshape_batch_x2(const std::string &model, const int &n);
TestResult test_set_input_params(const std::string &model, const int &n);
TestResult test_recreate_exenetwork(InferenceEngine::Core &ie, const std::string &model, const std::string &target_device, const int &n);
runTest(test_read_network, GetParam());
}
-TEST_P(UnitTestSuiteNoDevice, create_cnnnetwork) {
- runTest(test_create_cnnnetwork, GetParam());
-}
-
TEST_P(UnitTestSuiteNoDevice, cnnnetwork_reshape_batch_x2) {
runTest(test_cnnnetwork_reshape_batch_x2, GetParam());
}
runTest(test_read_network_full_pipeline, GetParam());
}
-TEST_P(UnitTestSuite, create_cnnnetwork_full_pipeline) {
- runTest(test_create_cnnnetwork_full_pipeline, GetParam());
-}
-
TEST_P(UnitTestSuite, set_input_params_full_pipeline) {
runTest(test_set_input_params_full_pipeline, GetParam());
}
if (i == n / 2) {
log_info("Half of the test have already passed");
}
- read_network(model)();
- }
-}
-
-void test_create_cnnnetwork(const std::string &model, const std::string &target_device, const int &n) {
- log_info("Create CNNNetwork from network: \"" << model << "\" for " << n << " times");
- for (int i = 0; i < n; i++) {
- if (i == n / 2) {
- log_info("Half of the test have already passed");
- }
- create_cnnnetwork(model)();
+ read_cnnnetwork(model)();
}
}
// tests_pipelines/tests_pipelines.cpp
void test_load_unload_plugin(const std::string &model, const std::string &target_device, const int &n);
void test_read_network(const std::string &model, const std::string &target_device, const int &n);
-void test_create_cnnnetwork(const std::string &model, const std::string &target_device, const int &n);
void test_cnnnetwork_reshape_batch_x2(const std::string &model, const std::string &target_device, const int &n);
void test_set_input_params(const std::string &model, const std::string &target_device, const int &n);
void test_create_exenetwork(const std::string &model, const std::string &target_device, const int &n);
// tests_pipelines/tests_pipelines_full_pipeline.cpp
void test_load_unload_plugin_full_pipeline(const std::string &model, const std::string &target_device, const int &n);
void test_read_network_full_pipeline(const std::string &model, const std::string &target_device, const int &n);
-void test_create_cnnnetwork_full_pipeline(const std::string &model, const std::string &target_device, const int &n);
void test_set_input_params_full_pipeline(const std::string &model, const std::string &target_device, const int &n);
void test_cnnnetwork_reshape_batch_x2_full_pipeline(const std::string &model, const std::string &target_device, const int &n);
void test_create_exenetwork_full_pipeline(const std::string &model, const std::string &target_device, const int &n);
void test_read_network_full_pipeline(const std::string &model, const std::string &target_device, const int &n) {
log_info("Read network: \"" << model << "\" for " << n << " times");
Core ie;
- IE_SUPPRESS_DEPRECATED_START
- std::shared_ptr<CNNNetReader> netReaderPtr;
- for (int i = 0; i < n; i++) {
- if (i == n / 2) {
- log_info("Half of the test have already passed");
- }
- CNNNetReader netReader;
- netReader.ReadNetwork(model);
- netReader.ReadWeights(fileNameNoExt(model) + ".bin");
- netReaderPtr = std::make_shared<CNNNetReader>(netReader);
- }
- CNNNetwork cnnNetwork = netReaderPtr->getNetwork();
- IE_SUPPRESS_DEPRECATED_END
- InputsDataMap inputInfo(cnnNetwork.getInputsInfo());
- ICNNNetwork::InputShapes shapes = cnnNetwork.getInputShapes();
- bool doReshape = false;
- for (auto &input : inputInfo) {
- setInputParameters();
- computeShapesToReshape();
- }
- reshapeCNNNetwork();
- ExecutableNetwork exeNetwork = ie.LoadNetwork(cnnNetwork, target_device);
- InferRequest infer_request = exeNetwork.CreateInferRequest();
- infer_request.Infer();
- OutputsDataMap output_info(cnnNetwork.getOutputsInfo());
- for (auto &output : output_info)
- Blob::Ptr outputBlob = infer_request.GetBlob(output.first);
-}
-
-void test_create_cnnnetwork_full_pipeline(const std::string &model, const std::string &target_device, const int &n) {
- log_info("Create CNNNetwork from network: \"" << model << "\" for " << n << " times");
- Core ie;
CNNNetwork cnnNetwork;
for (int i = 0; i < n; i++) {
if (i == n / 2) {