* [IE][nGraph]: Enables begin/end iterators for PartialShape
It's convenient to be able to use STL algorithms on
PartialShape since semantically PartialShape is a
sequence of Dimensions.
* [IE][VPU][nGraph]: Introduces tree utilities
Introduces Depth-First-Search and Breadth-First-Search
utilities for tree traversal. Templated arguments
makes them extensible for different use-case scenarios.
BFS is designed in way to make it possible to guarantee
node will be visited only after all its predecessors
have been visited:
a
/ \
b c
| |
d |
\ /
e
There with accordingly provided functors (NumEntries) it's
guaranteed node "e" will be visited after "d" and "c".
Such a property is important for nodes depth evaluation.
* [IE][VPU][nGraph]: Fixes printTo for nGraph type
For some reason if printTo for nGraph type is
usual function it's not picked up by VPU_THROW_UNLESS
triggered inside DynamicToStaticShape transformations.
Making it template specialization does the job.
* [IE][VPU]: Introduces SliceConfiguration class
SliceConfiguration is a class that's intended
to express the result of operation slicing by
batch. The result of slicing is configuration
that specifies what to do with each data object
associated with operation. There are two options
defined: Slice and Unchanged. Typical slice
scenario is Slice, when operation has the same
batch for all inputs and outputs, so all
corresponding data object will be "sliced"
(replaced with copy where batch equal to 1).
At some cases, data object should not sliced
(ex. if operation has constant input which
is the same for all input data batches and
so, does not have batch - Add of 2 tensors
with shapes [10, 1000] and [1000]). To
represent such cases there is option
"Unchanged".
At cases when operation should not be sliced
at all (ex. does not have batch, have different
batch for inputs and outputs, has static
batch and so on) SliceConfiguration object will
return false for "hasSlice" method call. In
these cases inputs and outputs methods calls
will throw an exception.
* [IE][VPU][nGraph]: Enables MatMul operation slice
In case of static batch, operation is not going to be sliced,
since for handling such cases other transformation is used.
Such approach allows both passes to co-exist while one is
being replaced with another.
If data input has other dynamic dimension than batch error
will be thrown since Myriad-X plugin does not support
convolutions (HW accelerated operations) with dynamism in
spatial dimensions.
* [IE][VPU][nGraph]: Enables Convolution operations slice
In case of static batch, operation is not going to be sliced,
since for handling such cases other transformation is used.
Such approach allows both passes to co-exist while one is
being replaced with another.
If data input has other dynamic dimension than batch error
will be thrown since Myriad-X plugin does not support
convolutions (HW accelerated operations) with dynamism in
spatial dimensions.
* [IE][VPU][nGraph]: Enables unary eltwise slice
Since extract dynamic batch transformation will handle
dynamism only by batch (so requires body loop to be static)
operations with dynamism in dimension other than batch should
not be covered by loop.
In case of dynamism in dimension other than batch eltwise
will be considered unsupported for sub-graph extraction.
* [IE][VPU][nGraph]: Enables binary eltwise slice
Since extract dynamic batch transformation will handle
dynamism only by batch (so requires body loop to be static)
operations with dynamism in dimension other than batch should
not be covered by loop.
In case of dynamism in dimension other than batch eltwise
will be considered unsupported for sub-graph extraction.
It's template function since different binary eltwise
operations have the same broadcasting rules.
* [IE][VPU][nGraph]: Enables extract dynamic batch transformation
General approach is following:
1. Extracted sub-graphs should have exactly one input and output
operation. Otherwise, it's possible that memory consumption of
model will be increased since loops implementation on Myriad-X
requires to keep all inputs and outputs of loop to be alive
along with memory used by loop body. In layout consolidation
scenario it reflects intention to use minimized amount of
permutations.
2. Extracted sub-graph should not have external connections (
the only nodes that allowed to have predecessor or successor
outside of sub-graph are input and output). Otherwise, it's
possible that memory consumption of model will be increased
for the same reason as in previous point.
To make sure this restriction is met transformation looks
for leaves in both directions, finds corresponding LCA
(Lowest Common Ancestor) and checks if such sub-graph has
external connections. If so, it repeats leaves search
procedure stopping if it approaches leaves from previous
iteration and finds LCA again. It is repeated until
sub-graph without external connections is found (it exists,
at least source itself forms it).
Leaf in current context is a node which satisfies one of
the following conditions (depending on direction):
Top:
1. It has no predecessors which are neither Parameter,
nor Constant
2. It's unknown how to slice this operation
3. It could not be sliced (different batch for inputs and
outputs)
Bottom:
1. It has no successors which are not Result
2. It's unknown how to slice this operation
3. It could not be sliced (different batch for inputs and
outputs)
Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>