[IE][VPU][nGraph]: Enables dynamic Reshape with non-const pattern support in myriad...
authorGladilov, Gleb <gleb.gladilov@intel.com>
Mon, 13 Jul 2020 15:19:05 +0000 (18:19 +0300)
committerGitHub <noreply@github.com>
Mon, 13 Jul 2020 15:19:05 +0000 (18:19 +0300)
commit543559f58c5b6ee7494d3d3448b02dc6f263c802
tree5c6d67f324367b7c47703d3789233658b3fa316f
parent08d8d36667a09dae7f81eed266cd12b346b386d2
[IE][VPU][nGraph]: Enables dynamic Reshape with non-const pattern support in myriad plugin (#1159)

* [IE][nGraph]: Introduces PartialShape ctor from values vector

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>
* [IE][VPU][nGraph]: Moves evaluateTargetShape to common utilities

The same functionality - get upper-bound shape estimation for dynamic
input - is needed in dynamic Reshape along with dynamic Broadcast.
Return value type has been changed from PartialShape to vector<int64_t>.
The reason is Reshape encodes special values (0, -1) into input values
that define output shape. Representing those values (which upper-bound
provides evaluateTargetShape) as PartialShape leads to incorrect
representation vector with -1 as dynamic shape - which is not expected.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>
* [IE][VPU][nGraph]: Introduces StaticShapeReshape

In comparison with original Reshape StaticShapeReshape propagates
upper-bound shape through a function in case of dynamic input. To do so,
shape inference method gets upper-bound shape from evaluateTargetShape,
decodes special values (0, -1) in it and then propagate the result.

Output shape processing happens only once, because if shape inference
were called after ShapeOf operations have been optimized out on dynamic
path, then evaluateTargetShape will require evaluate method for all
operations that appear in function before current Reshape. Since
evaluate method is implemented not for all operations it lead to
Faster-RCNN compilation error.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>
* [IE][VPU][nGraph]: Updates Reshape DTS on StaticShapeReshape

In case of non-const Reshape input that defines output shape DTS uses
StaticShapeReshape which propagates upper-bound shape evaluated from
this input through a function.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>
* [IE][VPU][nGraph][Tests]: Refactoring DTS Reshape tests

The only changes are:

* header files include reordering
* indentation/wrapping fixing

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>
* [IE][VPU][nGraph]: Moves ShapeOf transformation out of DTS scope

In comparison with DTS ShapeOf transformation needs to work on whole
function. Separating these 2 transformations makes testing easier since
now it's possible to call specific DTS without ShapeOf transformation
and vice versa.

Also DynamicToStaticShapeOf has been renamed into
EliminateShapeOfAfterDSR since transformation doesn't introduce new DSR
operations.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>
* [VPU][Tests]: Introduces DTS Reshape tests with non-const pattern

New StaticShapeReshape constructor has been added as well, since test
fixture should create it from reshape parameters, not reshape itself.

Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>
17 files changed:
inference-engine/src/vpu/common/include/vpu/ngraph/operations/static_shape_reshape.hpp [new file with mode: 0644]
inference-engine/src/vpu/common/include/vpu/ngraph/transformations/eliminate_shapeof_after_dsr.hpp [moved from inference-engine/src/vpu/common/include/vpu/ngraph/transformations/dynamic_to_static_shape_shapeof.hpp with 63% similarity]
inference-engine/src/vpu/common/include/vpu/ngraph/utilities.hpp [new file with mode: 0644]
inference-engine/src/vpu/common/src/ngraph/operations/static_shape_broadcast.cpp
inference-engine/src/vpu/common/src/ngraph/operations/static_shape_reshape.cpp [new file with mode: 0644]
inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape.cpp
inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_reshape.cpp
inference-engine/src/vpu/common/src/ngraph/transformations/eliminate_shapeof_after_dsr.cpp [moved from inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_shapeof.cpp with 86% similarity]
inference-engine/src/vpu/common/src/ngraph/utilities.cpp [new file with mode: 0644]
inference-engine/src/vpu/graph_transformer/src/frontend/frontend.cpp
inference-engine/src/vpu/graph_transformer/src/stages/reshape.cpp
inference-engine/src/vpu/myriad_plugin/myriad_plugin.cpp
inference-engine/tests/functional/plugin/myriad/ngraph/transformations/dynamic_to_static_shape_reshape.cpp
inference-engine/tests/functional/plugin/myriad/ngraph/transformations/eliminate_shapeof_after_dsr.cpp [moved from inference-engine/tests/functional/plugin/myriad/ngraph/transformations/dynamic_to_static_shape_shapeof.cpp with 84% similarity]
ngraph/src/ngraph/op/reshape.hpp
ngraph/src/ngraph/partial_shape.cpp
ngraph/src/ngraph/partial_shape.hpp