endif()
if(DEFINED IE_MAIN_SOURCE_DIR)
- set(InferenceEngine_LIBRARIES inference_engine)
+ set(InferenceEngine_LIBRARIES inference_engine inference_engine_plugin_api)
else()
find_package(InferenceEngineDeveloperPackage REQUIRED)
- set(InferenceEngine_LIBRARIES IE::inference_engine)
+ set(InferenceEngine_LIBRARIES IE::inference_engine IE::inference_engine_plugin_api)
endif()
if(UNIX)
#include <map>
#include <vector>
#include <set>
+#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
*/
#pragma once
-#include <details/ie_cnn_network_iterator.hpp>
#include <details/ie_exception_conversion.hpp>
#include <ie_icnn_network.hpp>
#include <map>
CNNLayerPtr getLayerByName(const char* layerName) const;
/**
- * @deprecated Use CNNNetwork::getFunction() and work with ngraph::Function directly. The method will be removed in 2021.1
- * @brief Begin layer iterator
- *
- * Order of layers is implementation specific,
- * and can be changed in future
- *
- * @return Iterator pointing to a layer
- */
- IE_SUPPRESS_DEPRECATED_START
- INFERENCE_ENGINE_DEPRECATED("Use CNNNetwork::getFunction() and work with ngraph::Function directly. The method will be removed in 2021.1")
- details::CNNNetworkIterator begin() const;
-
- /**
- * @deprecated Use CNNNetwork::getFunction() and work with ngraph::Function directly. The method will be removed in 2021.1
- * @brief End layer iterator
- * @return Iterator pointing to a layer
- */
- INFERENCE_ENGINE_DEPRECATED("Use CNNNetwork::getFunction() and work with ngraph::Function directly. The method will be removed in 2021.1")
- details::CNNNetworkIterator end() const;
- IE_SUPPRESS_DEPRECATED_END
-
- /**
- * @deprecated Use CNNNetwork::layerCount() instead. The method will be removed in 2021.1
- * @brief Number of layers in network object
- *
- * @return Number of layers.
- */
- INFERENCE_ENGINE_DEPRECATED("Use CNNNetwork::layerCount() instead. The method will be removed in 2021.1")
- size_t size() const;
-
- /**
* @brief Helper method to get collect all input shapes with names of corresponding Data objects
*
* @return Map of pairs: input name and its dimension.
#pragma once
#include <cpp/ie_cnn_network.h>
+#include "details/ie_cnn_network_iterator.hpp"
#include <ie_icnn_network.hpp>
#include <cnn_network_impl.hpp>
return layer;
}
-details::CNNNetworkIterator CNNNetwork::begin() const {
- return details::CNNNetworkIterator(actual);
-}
-
-details::CNNNetworkIterator CNNNetwork::end() const {
- return details::CNNNetworkIterator();
-}
-
-size_t CNNNetwork::size() const {
- return std::distance(std::begin(*this), std::end(*this));
-}
-
CNNLayer::CNNLayer(const LayerParams& prms)
: node(nullptr), name(prms.name), type(prms.type), precision(prms.precision), userValue({0}) {}
//
#include "ie_util_internal.hpp"
+#include "details/ie_cnn_network_iterator.hpp"
#include <ie_layers.h>
//
#include "low_precision_transformations/transformation_context.hpp"
+#include "details/ie_cnn_network_iterator.hpp"
using namespace InferenceEngine;
using namespace InferenceEngine::details;
#include <string>
#include <net_pass.h>
+#include <details/ie_cnn_network_iterator.hpp>
#include <details/caseless.hpp>
#include <vpu/compile_env.hpp>
#include <gtest/gtest.h>
#include <cnn_network_impl.hpp>
+#include <details/ie_cnn_network_iterator.hpp>
#include <string>
#include <sstream>
#include <fstream>
}
InferenceEngine::CNNNetwork cnnNet(ngraph);
- cnnNet.begin();
+ // convert to old representation
+ cnnNet.getInputsInfo().begin()->second->getInputData()->getCreatorLayer();
cnnNet.addOutput(testLayerName);
InferenceEngine::OutputsDataMap outs = cnnNet.getOutputsInfo();
cnnNet.addOutput(testLayerName);
ASSERT_NE(nullptr, cnnNet.getFunction());
ASSERT_EQ(5, cnnNet.layerCount());
- cnnNet.begin();
+ // convert to old representation
+ cnnNet.getInputsInfo().begin()->second->getInputData()->getCreatorLayer();
auto outputs = cnnNet.getOutputsInfo();
ASSERT_EQ(2, outputs.size());
ASSERT_TRUE(outputs.find("relu2") != outputs.end());
}
InferenceEngine::CNNNetwork cnnNet(ngraph);
- cnnNet.begin();
+ // convert to old representation
+ cnnNet.getInputsInfo().begin()->second->getInputData()->getCreatorLayer();
ASSERT_EQ(4, cnnNet.layerCount());
}
</edges>
</net>
)V0G0N";
- const Core ie;
- Blob::Ptr weights;
-
- auto network = ie.ReadNetwork(model, weights);
- auto inputInfo = network.getInputsInfo();
- auto cnnLayer = inputInfo.begin()->second->getInputData()->getCreatorLayer().lock();
- ASSERT_TRUE(cnnLayer);
- ASSERT_NE(cnnLayer->params.find("PrimitivesPriority"), cnnLayer->params.end());
- ASSERT_EQ("cpu:avx2", cnnLayer->params["PrimitivesPriority"]);
+ const Core ie;
+ Blob::Ptr weights;
+
+ auto network = ie.ReadNetwork(model, weights);
+ auto inputInfo = network.getInputsInfo();
+ auto cnnLayer = inputInfo.begin()->second->getInputData()->getCreatorLayer().lock();
+ ASSERT_TRUE(cnnLayer);
+ ASSERT_NE(cnnLayer->params.find("PrimitivesPriority"), cnnLayer->params.end());
+ ASSERT_EQ("cpu:avx2", cnnLayer->params["PrimitivesPriority"]);
}
TEST(CNNNGraphImplTests, ReadFromCNNNetReader) {
)V0G0N";
InferenceEngine::Core core;
CNNNetwork network = core.ReadNetwork(model, InferenceEngine::Blob::CPtr());
- network.begin();
- ASSERT_EQ(2, network.layerCount());
+ ASSERT_EQ(3, network.layerCount());
}
TEST(CNNNGraphImplTests, CanChangeInputPrecision) {
{
SCOPED_TRACE("Convert to old format");
- cnnNet.begin();
+ // convert to old representation
+ cnnNet.getInputsInfo().begin()->second->getInputData()->getCreatorLayer();
}
{
SCOPED_TRACE("After conversion");
{
SCOPED_TRACE("Convert to old format");
- cnnNet.begin();
+ // convert to old representation
+ cnnNet.getInputsInfo().begin()->second->getInputData()->getCreatorLayer();
}
{
SCOPED_TRACE("After conversion");
{
SCOPED_TRACE("Convert to old format");
- cnnNet.begin();
+ // convert to old representation
+ cnnNet.getInputsInfo().begin()->second->getInputData()->getCreatorLayer();
}
{
SCOPED_TRACE("After conversion");
{
SCOPED_TRACE("Convert to old format");
- cnnNet.begin();
+ // convert to old representation
+ cnnNet.getInputsInfo().begin()->second->getInputData()->getCreatorLayer();
}
{
SCOPED_TRACE("After conversion");
TEST_P(CNNNetworkSerializerTest, Serialize) {
InferenceEngine::Core ie;
InferenceEngine::CNNNetwork originalNetwork = ie.ReadNetwork(_modelPath, _weightsPath);
- IE_SUPPRESS_DEPRECATED_START
- originalNetwork.begin();
- IE_SUPPRESS_DEPRECATED_END
+ {
+ IE_SUPPRESS_DEPRECATED_START
+ // convert to old representation
+ originalNetwork.getInputsInfo().begin()->second->getInputData()->getCreatorLayer();
+ IE_SUPPRESS_DEPRECATED_END
+ }
originalNetwork.getInputsInfo().begin()->second->setPrecision(_netPrc);
originalNetwork.getOutputsInfo().begin()->second->setPrecision(_netPrc);
CommonTestUtils::fill_data(weights->buffer().as<float *>(), weights->size() / sizeof(float));
Core reader;
- auto nGraph = reader.ReadNetwork(model, weights);
- CNNNetwork cnn(nGraph);
+ auto cnn = reader.ReadNetwork(model, weights);
+
IE_SUPPRESS_DEPRECATED_START
- cnn.begin();
+ // convert to old representation
+ cnn.getInputsInfo().begin()->second->getInputData()->getCreatorLayer();
IE_SUPPRESS_DEPRECATED_END
}
Core reader;
ASSERT_THROW(reader.ReadNetwork(model, blob), InferenceEngine::details::InferenceEngineException);
}
-
-TEST_F(NGraphReaderTests, ConvertNGraphFromIterator) {
- std::string model = R"V0G0N(
-<net name="Network" version="10">
- <layers>
- <layer id="0" name="data" type="Parameter" version="opset1">
- <data element_type="f32" shape="1,3,227,227"/>
- <output>
- <port id="0" precision="FP32">
- <dim>1</dim>
- <dim>3</dim>
- <dim>227</dim>
- <dim>227</dim>
- </port>
- </output>
- </layer>
- <layer id="1" name="embedded_input__const" type="Const" version="opset1">
- <data offset="0" size="139392"/>
- <output>
- <port id="1" precision="FP32">
- <dim>96</dim>
- <dim>3</dim>
- <dim>11</dim>
- <dim>11</dim>
- </port>
- </output>
- </layer>
- <layer id="3" name="conv1" type="Convolution" version="opset1">
- <data dilations="1,1" group="1" kernel="11,11" output="96" pads_begin="0,0" pads_end="0,0" strides="4,4"/>
- <input>
- <port id="0" precision="FP32">
- <dim>1</dim>
- <dim>3</dim>
- <dim>227</dim>
- <dim>227</dim>
- </port>
- <port id="1" precision="FP32">
- <dim>96</dim>
- <dim>3</dim>
- <dim>11</dim>
- <dim>11</dim>
- </port>
- </input>
- <output>
- <port id="3" precision="FP32">
- <dim>1</dim>
- <dim>96</dim>
- <dim>55</dim>
- <dim>55</dim>
- </port>
- </output>
- </layer>
- <layer name="output" type="Result" id="2" version="opset1">
- <input>
- <port id="0" precision="FP32">
- <dim>1</dim>
- <dim>96</dim>
- <dim>55</dim>
- <dim>55</dim>
- </port>
- </input>
- </layer>
- </layers>
- <edges>
- <edge from-layer="0" from-port="0" to-layer="3" to-port="0"/>
- <edge from-layer="1" from-port="1" to-layer="3" to-port="1"/>
- <edge from-layer="3" from-port="3" to-layer="2" to-port="0"/>
- </edges>
-</net>
-)V0G0N";
-
- Blob::Ptr weights;
-
- weights = make_shared_blob<uint8_t>(TensorDesc(Precision::U8, {139392}, Layout::C));
- weights->allocate();
- CommonTestUtils::fill_data(weights->buffer().as<float *>(), weights->size() / sizeof(float));
-
- Core reader;
- auto nGraph = reader.ReadNetwork(model, weights);
- CNNNetwork network(nGraph);
-
- size_t layersCount = 0;
- IE_SUPPRESS_DEPRECATED_START
- for (auto it = network.begin(); it != network.end(); it++, layersCount++) {}
- IE_SUPPRESS_DEPRECATED_END
- ASSERT_EQ(layersCount, 2);
-}
#include <sstream>
#include <ie_core.hpp>
+#include <details/ie_cnn_network_iterator.hpp>
#include "common_test_utils/test_common.hpp"
#include "common_test_utils/file_utils.hpp"
FuncTestUtils::compareCNNNetworks(network, cnnNetwork, false);
IE_SUPPRESS_DEPRECATED_START
- for (auto it = network.begin(); it != network.end(); it++) {
+ auto & inetwork = static_cast<const ICNNNetwork&>(network);
+ for (auto it = details::CNNNetworkIterator(&inetwork); it != details::CNNNetworkIterator(); it++) {
InferenceEngine::CNNLayerPtr layer = *it;
ASSERT_NE(nullptr, layer->getNode());
}
- for (auto it = cnnNetwork.begin(); it != cnnNetwork.end(); it++) {
+ auto & icnnnetwork = static_cast<const ICNNNetwork&>(cnnNetwork);
+ for (auto it = details::CNNNetworkIterator(&icnnnetwork); it != details::CNNNetworkIterator(); it++) {
InferenceEngine::CNNLayerPtr layer = *it;
ASSERT_EQ(nullptr, layer->getNode());
}
Blob::CPtr blob;
Core reader;
- auto nGraph = reader.ReadNetwork(model, blob);
- CNNNetwork cnetwork(nGraph);
+ auto cnn = reader.ReadNetwork(model, blob);
+
IE_SUPPRESS_DEPRECATED_START
- cnetwork.begin();
+ // convert to old representation
+ cnn.getInputsInfo().begin()->second->getInputData()->getCreatorLayer();
IE_SUPPRESS_DEPRECATED_END
}
ngraph::ParameterVector{inp});
CNNNetwork cnn(ngraph_function);
- cnn.begin();
std::map<std::string, InferenceEngine::SizeVector> inShape;
inShape["test"] = {1, 3, 4, 5};
cnn.reshape(inShape);
#include "ie_common.h"
#include "common_test_utils/test_common.hpp"
+#include "details/ie_cnn_network_iterator.hpp"
#include <gtest/gtest.h>
private:
void triggerConversionToCNNNetwork() {
- cnnNetwork.begin();
+ // convert to old representation
+ cnnNetwork.getInputsInfo().begin()->second->getInputData()->getCreatorLayer();
}
static const char s_FriendlyName[];
set(TARGET_NAME funcTestUtils)
-list(APPEND EXPORT_DEPENDENCIES commonTestUtils inference_engine inference_engine_lp_transformations)
+list(APPEND EXPORT_DEPENDENCIES commonTestUtils inference_engine inference_engine_legacy
+ inference_engine_lp_transformations)
addIeTarget(
NAME ${TARGET_NAME}
void compareCNNNetworks(const InferenceEngine::CNNNetwork &network, const InferenceEngine::CNNNetwork &refNetwork,
bool sameNetVersions) {
- if (!sameNetVersions) {
- IE_SUPPRESS_DEPRECATED_START
- /* call conversion of the networks to CNNNetImpl to compare CNNLayers one by one */
- network.begin();
- refNetwork.begin();
- IE_SUPPRESS_DEPRECATED_END
- }
if (network.getName() != refNetwork.getName())
THROW_IE_EXCEPTION << "CNNNetworks have different names! " << network.getName()
<< " and " << refNetwork.getName();
THROW_IE_EXCEPTION << "CNNNetworks have different batch size! " << std::to_string(network.getBatchSize())
<< " and " << std::to_string(refNetwork.getBatchSize());
- if (network.layerCount() != refNetwork.layerCount())
- THROW_IE_EXCEPTION << "CNNNetworks have different numbers of layers! "
- << std::to_string(network.layerCount())
- << " and " << std::to_string(refNetwork.layerCount());
-
compareLayerByLayer<InferenceEngine::CNNNetwork>(network, refNetwork, sameNetVersions);
InferenceEngine::InputsDataMap newInput = network.getInputsInfo();
InferenceEngine::InputsDataMap oldInput = refNetwork.getInputsInfo();
#pragma once
#include "cpp/ie_cnn_network.h"
+#include "details/ie_cnn_network_iterator.hpp"
namespace FuncTestUtils {
IE_SUPPRESS_DEPRECATED_START
template <class T>
inline void compareLayerByLayer(const T& network, const T& refNetwork, bool sameNetVersions = true) {
+ auto & inetwork = static_cast<const InferenceEngine::ICNNNetwork&>(network);
+ auto iterator = InferenceEngine::details::CNNNetworkIterator(&inetwork);
+ auto & irefNetwork = static_cast<const InferenceEngine::ICNNNetwork&>(refNetwork);
+ auto refIterator = InferenceEngine::details::CNNNetworkIterator(&irefNetwork);
+ auto end = InferenceEngine::details::CNNNetworkIterator();
+ if (network.layerCount() != refNetwork.layerCount())
+ THROW_IE_EXCEPTION << "CNNNetworks have different number of layers: " << network.layerCount() << " vs " << refNetwork.layerCount();
+ for (; iterator != end && refIterator != end; iterator++, refIterator++) {
+ InferenceEngine::CNNLayerPtr layer = *iterator;
+ InferenceEngine::CNNLayerPtr refLayer = *refIterator;
+ compareCNNNLayers(layer, refLayer, sameNetVersions);
+ }
+}
+
+template <>
+inline void compareLayerByLayer(const std::vector<InferenceEngine::CNNLayerPtr>& network,
+ const std::vector<InferenceEngine::CNNLayerPtr>& refNetwork,
+ bool sameNetVersions) {
auto iterator = network.begin();
auto refIterator = refNetwork.begin();
if (network.size() != refNetwork.size())
- THROW_IE_EXCEPTION << "CNNNetworks have different number of layers: " << network.size() << " vs " << refNetwork.size();
+ THROW_IE_EXCEPTION << "CNNNetworks have different number of layers: " <<
+ network.size() << " vs " << refNetwork.size();
for (; iterator != network.end() && refIterator != refNetwork.end(); iterator++, refIterator++) {
InferenceEngine::CNNLayerPtr layer = *iterator;
InferenceEngine::CNNLayerPtr refLayer = *refIterator;
compareCNNNLayers(layer, refLayer, sameNetVersions);
}
}
+
IE_SUPPRESS_DEPRECATED_END
} // namespace FuncTestUtils
\ No newline at end of file
#pragma once
+#include <list>
#include <limits>
#include <gtest/gtest.h>
#include "base_matcher.hpp"
#include "classification_matcher.hpp"
#include <gtest/gtest.h>
#include <xml_helper.hpp>
+#include "details/ie_cnn_network_iterator.hpp"
using namespace Regression ;
using namespace Regression :: Matchers ;
-IE_SUPPRESS_DEPRECATED_START
ClassificationMatcher::ClassificationMatcher(RegressionConfig &config)
: BaseMatcher(config) {
// Get file names for files with weights and labels
top = (-1 == config.topKNumbers) ? 5 : config.topKNumbers;
}
-IE_SUPPRESS_DEPRECATED_END
void ClassificationMatcher::to(const std::vector <Regression::Reference::ClassificationScoringResultsForTests> &expected) {
checkResultNumber = 0;
#include <xml_helper.hpp>
#include "object_detection_matcher.hpp"
+#include "details/ie_cnn_network_iterator.hpp"
#include <algorithm>
}
void updatePaddings(const CNNNetwork &network, conv_test_params& p) {
- auto found = std::find_if(network.begin(), network.end(), [](const CNNLayer::Ptr& layer) {
+ auto & inetwork = (const ICNNNetwork &)network;
+ details::CNNNetworkIterator i(&inetwork), end;
+ auto found = std::find_if(i, end, [](const CNNLayer::Ptr& layer) {
return layer->type == "Convolution";
});
- ASSERT_NE(found, network.end());
+ ASSERT_NE(found, end);
auto convLayer = std::dynamic_pointer_cast<ConvolutionLayer>(*found);
auto allPad = getPaddings(*convLayer.get());
p.pads_begin[X_AXIS] = allPad.begin[X_AXIS];
#include <tests_common.hpp>
#include <ie_format_parser.h>
#include <ie_layers_internal.hpp>
-#include <ie_layers_internal.hpp>
+#include <details/ie_cnn_network_iterator.hpp>
#include <functional_test_utils/plugin_cache.hpp>
#include "conv_ref.hpp"
ConvolutionTestHelper::ConvolutionTestHelper(const CommonTestUtils::conv_common_params &_convParams) : LayerTestHelper("Convolution"), convParams(_convParams) {}
void ConvolutionTestHelper::updatePaddingValues(const CNNNetwork &network) {
- auto found = std::find_if(network.begin(), network.end(), [this](const CNNLayer::Ptr &layer) {
+ auto & inetwork = (const ICNNNetwork &)network;
+ details::CNNNetworkIterator i(&inetwork), end;
+ auto found = std::find_if(i, end, [this](const CNNLayer::Ptr &layer) {
return layer->type == type;
});
- ASSERT_NE(found, network.end());
+ ASSERT_NE(found, end);
auto castedLayer = std::dynamic_pointer_cast<ConvolutionLayer>(*found);
auto allPad = getPaddings(*castedLayer.get());
}
void DeformableConvolutionTestHelper::updatePaddingValues(const CNNNetwork &network) {
- auto found = std::find_if(network.begin(), network.end(), [this](const CNNLayer::Ptr &layer) {
+ auto & inetwork = (const ICNNNetwork &)network;
+ details::CNNNetworkIterator i(&inetwork), end;
+ auto found = std::find_if(i, end, [this](const CNNLayer::Ptr &layer) {
return layer->type == type;
});
- ASSERT_NE(found, network.end());
+ ASSERT_NE(found, end);
auto castedLayer = std::dynamic_pointer_cast<ConvolutionLayer>(*found);
auto allPad = getPaddings(*castedLayer.get());
}
void PoolingTestHelper::updatePaddingValues(const InferenceEngine::CNNNetwork &network) {
- auto found = std::find_if(network.begin(), network.end(), [this](const CNNLayer::Ptr &layer) {
+ auto & inetwork = (const ICNNNetwork &)network;
+ details::CNNNetworkIterator i(&inetwork), end;
+ auto found = std::find_if(i, end, [this](const CNNLayer::Ptr &layer) {
return layer->type == type;
});
- ASSERT_NE(found, network.end());
+ ASSERT_NE(found, end);
auto castedLayer = std::dynamic_pointer_cast<PoolingLayer>(*found);
auto allPad = getPaddings(*castedLayer.get());
#include <gtest/gtest.h>
#include <details/ie_cnn_network_tools.h>
+#include <details/ie_cnn_network_iterator.hpp>
#include <ie_core.hpp>
#include <ie_plugin_config.hpp>
#include <tests_common.hpp>
using namespace InferenceEngine::details;
using namespace InferenceEngine::PluginConfigParams;
-#define CHECK_MULTI() do { \
- try { \
- Core ie; \
- ie.GetVersions("MULTI"); \
- } catch (...) { \
- GTEST_SKIP(); \
- } \
- } while(false)\
-
class IEClassBasicTest : public TestsCommon {
public:
void SetUp() override {
}
TEST_F(IEClassBasicTest, smoke_ImportNetworkMultiThrows) {
- CHECK_MULTI();
InferenceEngine::Core ie;
ASSERT_THROW(ie.ImportNetwork("model", "MULTI"), InferenceEngineException);
}
}
TEST_P(IEClassNetworkTestP, QueryNetworkMultiThrows) {
- CHECK_MULTI();
Core ie;
ASSERT_THROW(ie.QueryNetwork(actualNetwork, "MULTI"), InferenceEngineException);
}
//
TEST_P(IEClassLoadNetworkTest, LoadNetworkHETEROwithMULTINoThrow) {
- CHECK_MULTI();
-
Core ie;
if (supportsDeviceID(ie, deviceName) && supportsAvaliableDevices(ie, deviceName)) {
std::string devices;
}
TEST_P(IEClassLoadNetworkTest, LoadNetworkMULTIwithHETERONoThrow) {
- CHECK_MULTI();
Core ie;
if (supportsDeviceID(ie, deviceName) && supportsAvaliableDevices(ie, deviceName)) {
//
TEST_P(IEClassLoadNetworkTest, QueryNetworkHETEROwithMULTINoThrowv7) {
- CHECK_MULTI();
Core ie;
if (supportsDeviceID(ie, deviceName) && supportsAvaliableDevices(ie, deviceName)) {
}
TEST_P(IEClassLoadNetworkTest, QueryNetworkMULTIwithHETERONoThrowv7) {
- CHECK_MULTI();
Core ie;
if (supportsDeviceID(ie, deviceName) && supportsAvaliableDevices(ie, deviceName)) {
}
TEST_P(IEClassLoadNetworkTest, DISABLED_QueryNetworkHETEROWithMULTINoThrowV10) {
- CHECK_MULTI();
Core ie;
if (supportsDeviceID(ie, deviceName) && supportsAvaliableDevices(ie, deviceName)) {
}
TEST_P(IEClassLoadNetworkTest, DISABLED_QueryNetworkMULTIWithHETERONoThrowV10) {
- CHECK_MULTI();
Core ie;
if (supportsDeviceID(ie, deviceName) && supportsAvaliableDevices(ie, deviceName)) {
using IEClassLoadNetworkAfterCoreRecreateTest = IEClassLoadNetworkTest;
TEST_P(IEClassLoadNetworkAfterCoreRecreateTest, LoadAfterRecreateCoresAndPlugins) {
- CHECK_MULTI();
Core ie;
{
auto versions = ie.GetVersions("MULTI:" + deviceName + ",CPU");
#include <gtest/gtest.h>
#include <ie_core.hpp>
+#include <details/ie_cnn_network_iterator.hpp>
#include "tests_common.hpp"
#include "single_layer_common.hpp"
}
void updatePaddings(const CNNNetwork &network, conv_test_params& p) {
- auto found = std::find_if(network.begin(), network.end(), [](const CNNLayer::Ptr& layer) {
+ auto & inetwork = static_cast<const ICNNNetwork &>(network);
+ details::CNNNetworkIterator i(&inetwork), end;
+ auto found = std::find_if(i, end, [](const CNNLayer::Ptr& layer) {
return layer->type == "Convolution";
});
- ASSERT_NE(found, network.end());
+ ASSERT_NE(found, end);
auto convLayer = std::dynamic_pointer_cast<ConvolutionLayer>(*found);
auto allPad = getPaddings(*convLayer.get());
p.pads_begin[X_AXIS] = allPad.begin[X_AXIS];
#include <details/ie_cnn_network_tools.h>
#include "unit_test_utils/mocks/mock_icnn_network.hpp"
+#include "details/ie_cnn_network_iterator.hpp"
using namespace std;
using namespace InferenceEngine;
std::vector<InferenceEngine::CNNLayerPtr> tiBodies;
- for (auto &layer : net_original) {
+ const auto & inetwork = static_cast<const ICNNNetwork&>(net_original);
+ for (auto layerIt = details::CNNNetworkIterator(&inetwork), end = details::CNNNetworkIterator();
+ layerIt != end; ++layerIt) {
+ auto layer = *layerIt;
if (layer->type == "TensorIterator") {
auto tiBody = NetPass::TIBodySortTopologically(std::dynamic_pointer_cast<InferenceEngine::TensorIterator>(layer)->body);
tiBodies.insert(tiBodies.end(), tiBody.begin(), tiBody.end());
#include "tests_common.hpp"
#include "ir_gen_helper.hpp"
#include <ie_core.hpp>
+#include "details/ie_cnn_network_iterator.hpp"
using namespace ::testing;
using namespace std;
graph.Infer(srcs, outputBlobs);
- for (auto& layer : network) {
- layer->params["PrimitivesPriority"] = "cpu:ref,cpu:ref_any";
+ const auto & inetwork = static_cast<const ICNNNetwork&>(network);
+ details::CNNNetworkIterator l(&inetwork), end;
+ for ( ; l != end; ++l) {
+ (*l)->params["PrimitivesPriority"] = "cpu:ref,cpu:ref_any";
}
MKLDNNGraphTestClass graph2;
graph2.CreateGraph(network);
#include "tests_common.hpp"
#include <ie_core.hpp>
+#include "details/ie_cnn_network_iterator.hpp"
#include <ngraph/ngraph.hpp>
auto graphInfer = [](InferenceEngine::CNNNetwork network, InferenceEngine::BlobMap& inBlobs,
InferenceEngine::BlobMap& outBlobs, std::string primitivesPriority) {
- for (auto it = network.begin(); !primitivesPriority.empty() && it !=network.end(); it++) {
+ const auto & inetwork = static_cast<const InferenceEngine::ICNNNetwork&>(network);
+ for (auto it = InferenceEngine::details::CNNNetworkIterator(&inetwork); !primitivesPriority.empty() &&
+ it != InferenceEngine::details::CNNNetworkIterator(); it++) {
(*it)->params["PrimitivesPriority"] = primitivesPriority;
}
auto graphInfer = [](InferenceEngine::CNNNetwork network, InferenceEngine::BlobMap& inBlobs,
InferenceEngine::BlobMap& outBlobs, std::string primitivesPriority) {
- for (auto it = network.begin(); !primitivesPriority.empty() && it !=network.end(); it++) {
+ const auto & inetwork = static_cast<const InferenceEngine::ICNNNetwork&>(network);
+ for (auto it = InferenceEngine::details::CNNNetworkIterator(&inetwork); !primitivesPriority.empty() &&
+ it != InferenceEngine::details::CNNNetworkIterator(); it++) {
(*it)->params["PrimitivesPriority"] = primitivesPriority;
}
InferenceEngine::Core ie;
auto network = ie.ReadNetwork(model, getConvWeightsBlob(p.in1, p.conv));
- network.begin(); // Call conversion from CNNNetwork NgraphImpl to CNNNetwork
std::shared_ptr<MKLDNNPlugin::Engine> score_engine(new MKLDNNPlugin::Engine());
InferenceEngine::IExecutableNetwork::Ptr exeNetwork1;
ASSERT_NO_THROW(score_engine->LoadNetwork(exeNetwork1, network, {}));
Core ie;
auto network = ie.ReadNetwork(model, getConvWeightsBlob(p.in1, p.conv));
- network.begin(); // Call conversion from CNNNetwork NgraphImpl to CNNNetwork
std::shared_ptr<MKLDNNPlugin::Engine> score_engine(new MKLDNNPlugin::Engine());
InferenceEngine::IExecutableNetwork::Ptr exeNetwork1;
Core ie;
auto network = ie.ReadNetwork(model, getConvWeightsBlob(p.in1, p.conv));
- network.begin(); // Call conversion from CNNNetwork NgraphImpl to CNNNetwork
std::shared_ptr<MKLDNNPlugin::Engine> score_engine(new MKLDNNPlugin::Engine());
InferenceEngine::IExecutableNetwork::Ptr exeNetwork1;
size_t weight_size = getConvWeightsSize(p.in1, p.conv1, "FP32") + getConvBiasesSize(p.conv1, "FP32") +
getConvWeightsSize(p.in2, p.conv2, "FP32") + getConvBiasesSize(p.conv2, "FP32");
auto network = ie.ReadNetwork(model, CommonTestUtils::getWeightsBlob(weight_size));
- network.begin(); // Call conversion from CNNNetwork NgraphImpl to CNNNetwork
std::shared_ptr<MKLDNNPlugin::Engine> score_engine(new MKLDNNPlugin::Engine());
InferenceEngine::IExecutableNetwork::Ptr exeNetwork1;
getConvWeightsSize(p.in2, p.conv2, "FP32") + getConvBiasesSize(p.conv2, "FP32") +
getConvWeightsSize(convOutShape3, p.conv3, "FP32") + getConvBiasesSize(p.conv3, "FP32");
auto network = ie.ReadNetwork(model, CommonTestUtils::getWeightsBlob(weight_size));
- network.begin(); // Call conversion from CNNNetwork NgraphImpl to CNNNetwork
std::shared_ptr<MKLDNNPlugin::Engine> score_engine(new MKLDNNPlugin::Engine());
InferenceEngine::IExecutableNetwork::Ptr exeNetwork1;
#include "ie_common.h"
#include <memory>
#include "details/ie_cnn_network_tools.h"
+#include "details/ie_cnn_network_iterator.hpp"
using namespace testing;
using namespace InferenceEngine;
prepareInputs(maps);
})));
- std::vector<CNNLayerPtr>resultedOrder;
- for (auto l : wrap) {
- resultedOrder.push_back(l);
+ std::vector<CNNLayerPtr> resultedOrder;
+ const auto & inetwork = static_cast<const ICNNNetwork&>(wrap);
+ details::CNNNetworkIterator l(&inetwork), end;
+ for ( ; l != end; ++l) {
+ resultedOrder.push_back(*l);
}
- ASSERT_EQ(wrap.size(), 8);
+ ASSERT_EQ(resultedOrder.size(), 8);
ASSERT_STREQ(resultedOrder[0]->name.c_str(), "2");
ASSERT_STREQ(resultedOrder[1]->name.c_str(), "6");
ASSERT_STREQ(resultedOrder[2]->name.c_str(), "1");
prepareInputs(maps);
})));
- std::vector<CNNLayerPtr>resultedOrder;
- for (auto l : wrap) {
- resultedOrder.push_back(l);
+ std::vector<CNNLayerPtr> resultedOrder;
+ const auto & inetwork = static_cast<const ICNNNetwork&>(wrap);
+ details::CNNNetworkIterator l(&inetwork), end;
+ for (; l != end; ++l) {
+ resultedOrder.push_back(*l);
}
- ASSERT_EQ(wrap.size(), 4);
+ ASSERT_EQ(resultedOrder.size(), 4);
ASSERT_STREQ(resultedOrder[0]->name.c_str(), "2");
ASSERT_STREQ(resultedOrder[1]->name.c_str(), "3");
ASSERT_STREQ(resultedOrder[2]->name.c_str(), "1");
prepareInputs(maps);
})));
- auto i = std::begin(wrap);
+ const auto & inetwork = static_cast<const ICNNNetwork&>(wrap);
+ details::CNNNetworkIterator i(&inetwork);
auto i2 = i;
i2++;
prepareInputs(maps);
})));
- ASSERT_EQ(std::begin(wrap), std::end(wrap));
+ const auto & inetwork = static_cast<const ICNNNetwork&>(wrap);
+ details::CNNNetworkIterator beg(&inetwork), end;
+ ASSERT_EQ(beg, end);
}
TEST_F(GraphToolsTest, CNNNetSwapLayersThrowsForNullPointers) {