res->params = params;
return res;
});
+
+ addSpecificCreator({"Transpose"}, [](const std::shared_ptr<::ngraph::Node>& node,
+ const std::map<std::string, std::string> params) -> CNNLayerPtr {
+ LayerParams attrs = {node->get_friendly_name(), "Permute",
+ details::convertPrecision(node->get_output_element_type(0))};
+ auto res = std::make_shared<InferenceEngine::CNNLayer>(attrs);
+ res->params = params;
+ if (auto transpose_const = std::dynamic_pointer_cast<ngraph::op::Constant>(node->input_value(1).get_node_shared_ptr())) {
+ res->params["order"] = Builder::asString(transpose_const->cast_vector<int64_t>());
+ }
+ return res;
+
+ });
}
CNNLayerPtr InferenceEngine::details::CNNLayerCreator::create() {
std::make_shared<Builder::NodeConverter<::ngraph::op::TileIE>>(),
std::make_shared<Builder::NodeConverter<::ngraph::op::v1::TopK>>(),
std::make_shared<Builder::NodeConverter<::ngraph::op::TopKIE>>(),
- std::make_shared<Builder::NodeConverter<::ngraph::op::Transpose>>(),
std::make_shared<Builder::NodeConverter<::ngraph::op::Unsqueeze>>(),
std::make_shared<Builder::NodeConverter<::ngraph::op::TensorIterator>>(),
std::make_shared<Builder::NodeConverter<::ngraph::op::LSTMCellIE>>(),
if (!axis_node_const) {
THROW_IE_EXCEPTION << "Split " << castedLayer->get_friendly_name() << " has no axes as Constant";
}
- auto axis = axis_node_const->get_vector<int64_t>()[0];
+ auto axis = axis_node_const->cast_vector<int64_t>()[0];
if (axis < 0) {
axis += castedLayer->get_input_shape(0).size();
}
if (!axis_node_const) {
THROW_IE_EXCEPTION << "Split " << castedLayer->get_friendly_name() << " has no axes as Constant";
}
- auto axis = axis_node_const->get_vector<int64_t>()[0];
+ auto axis = axis_node_const->cast_vector<int64_t>()[0];
if (axis < 0) {
axis += castedLayer->get_input_shape(0).size();
}
const auto constNode = castedLayer->get_inputs()[1].get_output().get_node();
if (auto constValue = ngraph::as_type_ptr<ngraph::op::Constant>(constNode)) {
- auto value = constValue->get_vector<int64_t>();
+ auto value = constValue->cast_vector<int64_t>();
for (auto & i : value) {
if (i == 0 && !castedLayer->get_special_zero())
THROW_IE_EXCEPTION << "Reshape " << params.name << " has `special_zero`=False and zeros in second input. This combination is not supported";
return res;
}
-template <>
-CNNLayer::Ptr NodeConverter<ngraph::op::Transpose>::createLayer(const std::shared_ptr<ngraph::Node>& layer) const {
- LayerParams params = {layer->get_friendly_name(), "Permute",
- details::convertPrecision(layer->get_output_element_type(0))};
- auto res = std::make_shared<InferenceEngine::CNNLayer>(params);
-
- NodeConverter<ngraph::op::Constant> converter;
- const auto orderNode = layer->get_inputs()[1].get_output().get_node();
- if (converter.canCreate(orderNode)) {
- const auto& orderLayer = converter.createLayer(orderNode);
- auto order = orderLayer->blobs["custom"];
- int64_t* data = order->buffer().as<int64_t*>();
- std::string orderStr;
- for (size_t i = 0; i < order->size(); i++) {
- if (!orderStr.empty()) orderStr += ",";
- orderStr += asString(data[i]);
- }
- res->params["order"] = orderStr;
- }
-
- return res;
-}
-
template <>
CNNLayer::Ptr NodeConverter<ngraph::op::Proposal>::createLayer(const std::shared_ptr<ngraph::Node>& layer) const {
THROW_IE_EXCEPTION << "Proposal operation should be converted to ProposalIE";