Removed NgraphData (#1416)
This commit is contained in:
parent
e5dfb71178
commit
3be1f6b6fa
@ -62,11 +62,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
Data & operator = (const Data& data);
|
Data & operator = (const Data& data);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief A virtual destructor
|
|
||||||
*/
|
|
||||||
virtual ~Data() = default;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Checks if the current node is resolved
|
* @brief Checks if the current node is resolved
|
||||||
*
|
*
|
||||||
|
@ -101,7 +101,7 @@ void CNNNetworkNGraphImpl::createDataForResult(const ::ngraph::Output<::ngraph::
|
|||||||
} else {
|
} else {
|
||||||
const auto precision = details::convertPrecision(output.get_element_type());
|
const auto precision = details::convertPrecision(output.get_element_type());
|
||||||
const auto layout = TensorDesc::getLayoutByDims(dims);
|
const auto layout = TensorDesc::getLayoutByDims(dims);
|
||||||
ptr.reset(new NGraphData(this, outName, {precision, dims, layout}));
|
ptr.reset(new Data(outName, {precision, dims, layout}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,15 +146,6 @@ CNNNetworkNGraphImpl::CNNNetworkNGraphImpl(const std::shared_ptr<Function>& nGra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CNNNetworkNGraphImpl::~CNNNetworkNGraphImpl() {
|
|
||||||
for (auto& data : _data) {
|
|
||||||
if (!data.second) continue;
|
|
||||||
if (auto nData = std::dynamic_pointer_cast<NGraphData>(data.second)) {
|
|
||||||
nData->reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CNNNetworkNGraphImpl::setInputInfo(InputInfo::Ptr data) {
|
void CNNNetworkNGraphImpl::setInputInfo(InputInfo::Ptr data) {
|
||||||
if (cnnNetwork) cnnNetwork->setInputInfo(data);
|
if (cnnNetwork) cnnNetwork->setInputInfo(data);
|
||||||
_inputData[data->name()] = data;
|
_inputData[data->name()] = data;
|
||||||
|
@ -43,7 +43,7 @@ namespace details {
|
|||||||
class INFERENCE_ENGINE_API_CLASS(CNNNetworkNGraphImpl): public ICNNNetwork {
|
class INFERENCE_ENGINE_API_CLASS(CNNNetworkNGraphImpl): public ICNNNetwork {
|
||||||
public:
|
public:
|
||||||
CNNNetworkNGraphImpl(const std::shared_ptr<::ngraph::Function>& nGraph);
|
CNNNetworkNGraphImpl(const std::shared_ptr<::ngraph::Function>& nGraph);
|
||||||
~CNNNetworkNGraphImpl() override;
|
~CNNNetworkNGraphImpl() override = default;
|
||||||
|
|
||||||
void getOutputsInfo(std::map<std::string, DataPtr>& out) const noexcept override;
|
void getOutputsInfo(std::map<std::string, DataPtr>& out) const noexcept override;
|
||||||
|
|
||||||
@ -118,8 +118,6 @@ private:
|
|||||||
CNNNetworkImpl* cnnNetworkImpl,
|
CNNNetworkImpl* cnnNetworkImpl,
|
||||||
bool keep_constant_inputs);
|
bool keep_constant_inputs);
|
||||||
|
|
||||||
friend class NGraphData;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reshape on the same shape
|
* @brief Reshape on the same shape
|
||||||
*/
|
*/
|
||||||
@ -135,32 +133,5 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IE_SUPPRESS_DEPRECATED_START
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Special derived class of Data which converts CNNNetworkNGraphImpl to CNNLayer-based representation
|
|
||||||
* in case if a user called Data::getCreatorLayer or Data::getInputTo
|
|
||||||
*/
|
|
||||||
class NGraphData : public Data {
|
|
||||||
public:
|
|
||||||
using Ptr = std::shared_ptr<NGraphData>;
|
|
||||||
|
|
||||||
NGraphData(CNNNetworkNGraphImpl* network, const std::string& name, const TensorDesc& desc)
|
|
||||||
: Data(name, desc), network(network) {}
|
|
||||||
|
|
||||||
void reset() {
|
|
||||||
network = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
CNNLayerWeakPtr& getCreatorLayer();
|
|
||||||
|
|
||||||
std::map<std::string, CNNLayerPtr>& getInputTo();
|
|
||||||
|
|
||||||
private:
|
|
||||||
CNNNetworkNGraphImpl* network;
|
|
||||||
};
|
|
||||||
|
|
||||||
IE_SUPPRESS_DEPRECATED_END
|
|
||||||
|
|
||||||
} // namespace details
|
} // namespace details
|
||||||
} // namespace InferenceEngine
|
} // namespace InferenceEngine
|
||||||
|
@ -110,11 +110,7 @@ const SizeVector& Data::getDims() const {
|
|||||||
// compatibility
|
// compatibility
|
||||||
|
|
||||||
CNNLayerWeakPtr& InferenceEngine::getCreatorLayer(const DataPtr & data) {
|
CNNLayerWeakPtr& InferenceEngine::getCreatorLayer(const DataPtr & data) {
|
||||||
if (auto ndata = std::dynamic_pointer_cast<details::NGraphData>(data)) {
|
return data->_impl->creatorLayer;
|
||||||
return ndata->getCreatorLayer();
|
|
||||||
} else {
|
|
||||||
return data->_impl->creatorLayer;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, CNNLayerPtr>& InferenceEngine::getInputTo(const DataPtr & data) {
|
std::map<std::string, CNNLayerPtr>& InferenceEngine::getInputTo(const DataPtr & data) {
|
||||||
@ -124,11 +120,3 @@ std::map<std::string, CNNLayerPtr>& InferenceEngine::getInputTo(const DataPtr &
|
|||||||
std::map<std::string, CNNLayerPtr>& InferenceEngine::getInputTo(Data * data) {
|
std::map<std::string, CNNLayerPtr>& InferenceEngine::getInputTo(Data * data) {
|
||||||
return data->_impl->inputTo;
|
return data->_impl->inputTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
CNNLayerWeakPtr& details::NGraphData::getCreatorLayer() {
|
|
||||||
return _impl->creatorLayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::map<std::string, CNNLayerPtr>& details::NGraphData::getInputTo() {
|
|
||||||
return _impl->inputTo;
|
|
||||||
}
|
|
||||||
|
@ -814,8 +814,7 @@ void convertFunctionToICNNNetwork(const std::shared_ptr<const ::ngraph::Function
|
|||||||
std::string outName = layer->get_friendly_name();
|
std::string outName = layer->get_friendly_name();
|
||||||
if (layer->get_output_size() != 1) outName += "." + std::to_string(i);
|
if (layer->get_output_size() != 1) outName += "." + std::to_string(i);
|
||||||
DataPtr &ptr = cnnNetworkImpl->getData(outName.c_str());
|
DataPtr &ptr = cnnNetworkImpl->getData(outName.c_str());
|
||||||
SizeVector dims;
|
SizeVector dims = layer->get_output_shape(i);
|
||||||
dims = layer->get_output_shape(i);
|
|
||||||
for (const auto &dim : dims) {
|
for (const auto &dim : dims) {
|
||||||
if (!dim)
|
if (!dim)
|
||||||
THROW_IE_EXCEPTION << cnnLayer->type << " layer " << cnnLayer->name
|
THROW_IE_EXCEPTION << cnnLayer->type << " layer " << cnnLayer->name
|
||||||
@ -823,14 +822,13 @@ void convertFunctionToICNNNetwork(const std::shared_ptr<const ::ngraph::Function
|
|||||||
}
|
}
|
||||||
if (!ptr && nGraphImpl && nGraphImpl->_data.find(outName) != nGraphImpl->_data.end()) {
|
if (!ptr && nGraphImpl && nGraphImpl->_data.find(outName) != nGraphImpl->_data.end()) {
|
||||||
ptr = nGraphImpl->_data.at(outName);
|
ptr = nGraphImpl->_data.at(outName);
|
||||||
if (auto nData = std::dynamic_pointer_cast<InferenceEngine::details::NGraphData>(ptr)) {
|
{
|
||||||
const auto layout =
|
const auto layout =
|
||||||
dims.size() == nData->getTensorDesc().getDims().size() ?
|
dims.size() == ptr->getTensorDesc().getDims().size() ?
|
||||||
nData->getTensorDesc().getLayout() :
|
ptr->getTensorDesc().getLayout() :
|
||||||
TensorDesc::getLayoutByDims(dims);
|
TensorDesc::getLayoutByDims(dims);
|
||||||
|
|
||||||
nData->reset();
|
ptr->reshape(dims, layout);
|
||||||
nData->reshape(dims, layout);
|
|
||||||
}
|
}
|
||||||
cnnNetworkImpl->addData(outName.c_str(), ptr);
|
cnnNetworkImpl->addData(outName.c_str(), ptr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user