Skip to content

Commit

Permalink
[CPU] Added improvements for StridedSlice (openvinotoolkit#4248)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-sidorova authored Apr 8, 2021
1 parent 0034749 commit 37893ca
Show file tree
Hide file tree
Showing 15 changed files with 1,062 additions and 1,176 deletions.
1 change: 0 additions & 1 deletion inference-engine/src/mkldnn_plugin/mkldnn_exec_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ bool MKLDNNExecNetwork::CanProcessDynBatch(const InferenceEngine::CNNNetwork &ne
type != Split &&
type != Concatenation &&
type != Eltwise &&
type != Crop &&
type != BatchNormalization &&
type != Copy) {
check_result = false;
Expand Down
4 changes: 2 additions & 2 deletions inference-engine/src/mkldnn_plugin/mkldnn_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <nodes/mkldnn_batchnorm_node.h>
#include <nodes/mkldnn_concat_node.h>
#include <nodes/mkldnn_conv_node.h>
#include <nodes/mkldnn_crop_node.h>
#include <nodes/mkldnn_deconv_node.h>
#include <nodes/mkldnn_eltwise_node.h>
#include <nodes/mkldnn_gemm_node.h>
Expand All @@ -39,6 +38,7 @@
#include <nodes/mkldnn_tensoriterator_node.h>
#include <nodes/mkldnn_scatter_update_node.h>
#include <nodes/mkldnn_interpolate_node.h>
#include <nodes/mkldnn_strided_slice_node.h>
#include <mkldnn_types.h>
#include <dnnl_types.h>
#include "mkldnn_extension_utils.h"
Expand Down Expand Up @@ -93,7 +93,6 @@ static const InferenceEngine::details::caseless_unordered_map<std::string, Type>
{ "Eltwise", Eltwise },
{ "Mod", Eltwise },
{ "Power", Eltwise },
{ "Crop", Crop },
{ "Reshape", Reshape },
{ "Tile", Tile },
{ "SimplerNMS", SimplerNMS },
Expand All @@ -103,6 +102,7 @@ static const InferenceEngine::details::caseless_unordered_map<std::string, Type>
{ "Flatten", Flatten },
{ "Pad", Pad },
{ "Permute", Permute },
{ "StridedSlice", StridedSlice },
{ "Copy", Copy },
{ "LSTMCell", RNNCell },
{ "GRUCell", RNNCell },
Expand Down
6 changes: 3 additions & 3 deletions inference-engine/src/mkldnn_plugin/mkldnn_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ enum Type {
Concatenation,
Eltwise,
Gemm,
Crop,
Reshape,
Tile,
SimplerNMS,
Expand All @@ -58,6 +57,7 @@ enum Type {
Flatten,
Pad,
Permute,
StridedSlice,
Copy,
MemoryOutput,
MemoryInput,
Expand Down Expand Up @@ -122,8 +122,6 @@ static std::string NameFromType(Type type) {
return "Concatenation";
case Depthwise:
return "Depthwise";
case Crop:
return "Crop";
case Reshape:
return "Reshape";
case Tile:
Expand All @@ -142,6 +140,8 @@ static std::string NameFromType(Type type) {
return "Pad";
case Permute:
return "Permute";
case StridedSlice:
return "StridedSlice";
case Copy:
return "Copy";
case MemoryOutput:
Expand Down
2 changes: 2 additions & 0 deletions inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <legacy/transformations/convert_opset1_to_legacy/reshape_fully_connected.hpp>
#include <legacy/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.hpp>
#include <legacy/transformations/convert_opset1_to_legacy/convert_interpolate_to_interp_or_resample.hpp>
#include <legacy/transformations/convert_opset1_to_legacy/convert_strided_slice_to_crop.hpp>
#include <legacy/ngraph_ops/fully_connected.hpp>

#include <transformations/opset_conversions/convert_opset3_to_opset2.hpp>
Expand Down Expand Up @@ -333,6 +334,7 @@ static void Transformation(CNNNetwork& clonedNetwork, const Config& conf) {
legacyManager.register_pass<ngraph::pass::UnrollTensorIterator>();

auto legacyPassConfig = legacyManager.get_pass_config();
legacyPassConfig->disable<ngraph::pass::ConvertStridedSliceToCropMatcher>();

legacyPassConfig->set_callback<ngraph::pass::FakeQuantizeDecomposition>([](const_node_ptr &node) -> bool {
return !MKLDNNQuantizeNode::isNeedToDecompose(node);
Expand Down
1 change: 0 additions & 1 deletion inference-engine/src/mkldnn_plugin/nodes/list_tbl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ MKLDNN_EXTENSION_NODE(ReverseSequenceImpl, ReverseSequence);
MKLDNN_EXTENSION_NODE(DetectionOutputImpl, DetectionOutput);
MKLDNN_EXTENSION_NODE(ArgMaxImpl, ArgMax);
MKLDNN_EXTENSION_NODE(UnsqueezeImpl, Unsqueeze);
MKLDNN_EXTENSION_NODE(StridedSliceImpl, StridedSlice);
MKLDNN_EXTENSION_NODE(ExperimentalDetectronDetectionOutputImpl, ExperimentalDetectronDetectionOutput);
MKLDNN_EXTENSION_NODE(RegionYoloImpl, RegionYolo);
MKLDNN_EXTENSION_NODE(LogSoftmaxImpl, LogSoftmax);
Expand Down
194 changes: 0 additions & 194 deletions inference-engine/src/mkldnn_plugin/nodes/mkldnn_crop_node.cpp

This file was deleted.

35 changes: 0 additions & 35 deletions inference-engine/src/mkldnn_plugin/nodes/mkldnn_crop_node.h

This file was deleted.

10 changes: 6 additions & 4 deletions inference-engine/src/mkldnn_plugin/nodes/mkldnn_pad_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,12 @@ static inline size_t parallel_init(size_t start, size_t nDims, const SizeVector&
}

static inline void parallel_step(size_t nDims, const SizeVector& dims, SizeVector& indexes) {
for (int j = nDims - 1; j >= 0; j--) {
indexes[j] = (indexes[j] + 1) % dims[j];
if (indexes[j] != 0)
return;
for (int j = nDims - 1; j >= 0; --j) {
++indexes[j];
if (indexes[j] < dims[j])
break;
else
indexes[j] = 0;
}
}

Expand Down
Loading

0 comments on commit 37893ca

Please sign in to comment.