-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reshape able slice #1241
Reshape able slice #1241
Conversation
61937ba
to
e43d33b
Compare
26b3843
to
a76ebcf
Compare
a76ebcf
to
322142e
Compare
322142e
to
4dfa2f3
Compare
model-optimizer/extensions/front/onnx/AttributedSliceToSlice_test.py
Outdated
Show resolved
Hide resolved
55eadc5
to
0fd6d56
Compare
@jane-intel , please, review the PR. |
@jane-intel, please, take a look. |
…corrected SliceConverter and added unittests for all cases
…ence; moved mxlice inside of slice.py; renamed slice_replacers
…s fro slice_replacer onnx phase
…pe calculation, and some other minor corrections
a8730d3
to
a28d5bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @jane-intel, please, have a fresh look at this PR.
model-optimizer/extensions/front/onnx/AttributedSliceToSlice.py
Outdated
Show resolved
Hide resolved
|
||
def replace_sub_graph(self, graph: Graph, match: dict): | ||
""" | ||
This transformation converts TFSlice to internal Slice operation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transformation itself is not commented -- what is happening
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved comments to class level. Please review.
model-optimizer/mo/ops/slice.py
Outdated
|
||
""" | ||
Slicing operations have different semantic or different parameters/inputs in different frameworks. To distinguish them | ||
and not confuse with OpenVINO Slice several Model Optimizer internal operations are introduced. OpenVINO Slice operation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no OpenVINO Slice operation. We should not confuse people
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Clarified this. Please review.
model-optimizer/mo/ops/slice.py
Outdated
|
||
|
||
class Slice(Op): | ||
""" | ||
Semantic of OpenVINO Slice operation is identical ONNX Slice (opset >= 10). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no OpenVINO Slice operation. It is not in public opset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated comments. Please review.
|
||
def __init__(self, graph: Graph, attrs: dict): | ||
def __init__(self, graph: Graph, attrs: dict = None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you set arrts to None, but everywhere else -- we don't do this. What was original reason to do so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this default value to avoid specifying when I call constrictor, e.g. here TFSliceToSlice.py:41
slice_node = Slice(graph).create_node()
At the moment it looks like it's the only place where Slice constructor is called explicitly. I guess in the draft versions of PR i was using it more often and it remained here for historical reason. I advocate to leave this default argument here.
* Added Caffe Slice_ext * Added TFSlice, AttributedSlice (both with extractors and replacers), corrected SliceConverter and added unittests for all cases * added comments to each type of Slice operation; optimized shape inference; moved mxlice inside of slice.py; renamed slice_replacers * removed type annotation for get_shape_after_slice routine * replaced zeros_like with zeros * Corrected preserving node names, renamed attributes names, added tests fro slice_replacer onnx phase * Renamed slice_replacers.py * added more unittest cases * added type annotations, moved to more relevant place routines for shape calculation, and some other minor corrections * corrected a typo `normalize_slice_indices` comment * corrected shape calculation for Nonconstant inputs * corrected a few typos * corrected type declarations * corrected shape inference with rounding * refactored unit-tests for front transforms of Slice * added error raising for negative and zero shapes * removed magic_num * corrected AttributedSlice, clarified comments * fixed unit-test for AttributedSliceToSlice * typo in type hints corrected * removed supported_attrs * returned back default None for attrs of Slice
* Added Caffe Slice_ext * Added TFSlice, AttributedSlice (both with extractors and replacers), corrected SliceConverter and added unittests for all cases * added comments to each type of Slice operation; optimized shape inference; moved mxlice inside of slice.py; renamed slice_replacers * removed type annotation for get_shape_after_slice routine * replaced zeros_like with zeros * Corrected preserving node names, renamed attributes names, added tests fro slice_replacer onnx phase * Renamed slice_replacers.py * added more unittest cases * added type annotations, moved to more relevant place routines for shape calculation, and some other minor corrections * corrected a typo `normalize_slice_indices` comment * corrected shape calculation for Nonconstant inputs * corrected a few typos * corrected type declarations * corrected shape inference with rounding * refactored unit-tests for front transforms of Slice * added error raising for negative and zero shapes * removed magic_num * corrected AttributedSlice, clarified comments * fixed unit-test for AttributedSliceToSlice * typo in type hints corrected * removed supported_attrs * returned back default None for attrs of Slice
Description:
Cherry-pick form here #1194- removed Slice operation in Kaldi- parallel component in Kaldi is supported by Split operationprevious paragraph is not actual anymore, mentioned PR was merged
#34041
Code:
Validation:
Documentation: