Skip to content

Commit

Permalink
Added support for the MxNet op take (#4071)
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarevevgeny authored Jan 29, 2021
1 parent 7500bbd commit 3669205
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/MO_DG/prepare_model/Supported_Frameworks_Layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ Standard MXNet\* symbols:
| SoftmaxActivation | No |
| SoftmaxOutput | No |
| SoftSign | No |
| Take | The attribute 'mode' is not supported |
| Tile | No |
| UpSampling | No |
| Where | No |
Expand Down
1 change: 1 addition & 0 deletions model-optimizer/automation/package_BOM.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ extensions/front/mxnet/ssd_pattern_remove_transpose.py
extensions/front/mxnet/ssd_reorder_detection_out_inputs.py
extensions/front/mxnet/stack_ext.py
extensions/front/mxnet/swapaxis_ext.py
extensions/front/mxnet/take_ext.py
extensions/front/mxnet/tile_ext.py
extensions/front/mxnet/tile_replacer.py
extensions/front/mxnet/transpose_ext.py
Expand Down
33 changes: 33 additions & 0 deletions model-optimizer/extensions/front/mxnet/take_ext.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""
Copyright (C) 2017-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

from extensions.ops.gather import AttributedGather
from mo.front.extractor import FrontExtractorOp
from mo.front.mxnet.extractors.utils import get_mxnet_layer_attrs
from mo.graph.graph import Node


class TakeExtractor(FrontExtractorOp):
op = 'take'
enabled = True

@classmethod
def extract(cls, node: Node):
attrs = get_mxnet_layer_attrs(node.symbol_dict)
AttributedGather.update_node_stat(node, {
'axis': attrs.int('axis', 0),
})
return cls.enabled

0 comments on commit 3669205

Please sign in to comment.