Update operation attributes (#3814)
* Allign attribute values in spec * Fix wrong attribute name in spec * Add `get_boolean_attr` function * Add get_type function * Update conv attrs * Update copyright year * Add missed attrs, update copyright year * Fix year in copyright * Update ir parser for RegionYolo layer * Remove wrong changes for BinaryConvolution * Remove get_type function as it no more needed * Update check for reduce ops * Fix error in reduce attrs * Update ir_engine to work with bool attrs * Update DetectionOutput operation * Update PSROIPooling * remove redundant attrs from spec * Update get_boolean_attr function * Update Reduce operations * Update DetectionOutput specification * Update specification for missed attrs * Apply comments * Fixconst renumbering logic * Fix typo * Change default value to fix broken shape inference * Add additional asserts * Add comment * model-optimizer/mo/utils/ir_reader/layer_to_class.py * Sort imports * Sort imports * Update year in copyright * Update const * Remove changes from const restoring * Rename function * remove unnecessary changes * model-optimizer/mo/front/extractor_test.py * Fix year in copyright * Add soft_get * Fix exclude-pad attribute name for AvgPool operation * Update exclude_pad attribute values * Remove useless comment * Update examples in specification * Remove file added by mistake * Resolve comments * Resolve comments * Add return value * Allign global_pool attribute
This commit is contained in:
parent
a8b921791e
commit
6b54e738d7
@ -90,7 +90,7 @@ The box coordinates are specified as five element tuples: *[batch_id, x_1, y_1,
|
||||
|
||||
```xml
|
||||
<layer ... type="DeformablePSROIPooling" ... >
|
||||
<data group_size="7" mode="bilinear_deformable" no_trans="False" output_dim="8" part_size="7" pooled_height="7" pooled_width="7" spatial_bins_x="4" spatial_bins_y="4" spatial_scale="0.0625" trans_std="0.1"/>
|
||||
<data group_size="7" mode="bilinear_deformable" output_dim="8" part_size="7" spatial_bins_x="4" spatial_bins_y="4" spatial_scale="0.0625" trans_std="0.1"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
<dim>1</dim>
|
||||
|
@ -156,7 +156,7 @@ At each feature map cell, *DetectionOutput* predicts the offsets relative to the
|
||||
|
||||
```xml
|
||||
<layer ... type="DetectionOutput" ... >
|
||||
<data background_label_id="1" code_type="caffe.PriorBoxParameter.CENTER_SIZE" confidence_threshold="0.019999999552965164" eta="1.0" height="0" height_scale="0" input_height="1" input_width="1" interp_mode="" keep_top_k="200" nms_threshold="0.44999998807907104" normalized="1" num_classes="2" pad_mode="" pad_value="" prob="0" resize_mode="" share_location="1" top_k="200" variance_encoded_in_target="0" visualize_threshold="0.6" width="0" width_scale="0"/>
|
||||
<data background_label_id="1" code_type="caffe.PriorBoxParameter.CENTER_SIZE" confidence_threshold="0.019999999552965164" input_height="1" input_width="1" keep_top_k="200" nms_threshold="0.44999998807907104" normalized="true" num_classes="2" share_location="true" top_k="200" variance_encoded_in_target="false" clip_after_nms="false" clip_before_nms="false" objectness_score="0" decrease_label_id="false"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
<dim>1</dim>
|
||||
|
@ -110,7 +110,7 @@ If *clip* is defined, the coordinates of prior boxes are recalculated with the f
|
||||
|
||||
```xml
|
||||
<layer type="PriorBoxClustered" ... >
|
||||
<data clip="0" flip="1" height="44.0,10.0,30.0,19.0,94.0,32.0,61.0,53.0,17.0" offset="0.5" step="16.0" variance="0.1,0.1,0.2,0.2" width="86.0,13.0,57.0,39.0,68.0,34.0,142.0,50.0,23.0"/>
|
||||
<data clip="false" height="44.0,10.0,30.0,19.0,94.0,32.0,61.0,53.0,17.0" offset="0.5" step="16.0" variance="0.1,0.1,0.2,0.2" width="86.0,13.0,57.0,39.0,68.0,34.0,142.0,50.0,23.0"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
<dim>2</dim> <!-- [10, 19] -->
|
||||
|
@ -160,7 +160,7 @@
|
||||
|
||||
```xml
|
||||
<layer type="PriorBox" ...>
|
||||
<data aspect_ratio="2.0" clip="0" density="" fixed_ratio="" fixed_size="" flip="1" max_size="38.46" min_size="16.0" offset="0.5" step="16.0" variance="0.1,0.1,0.2,0.2"/>
|
||||
<data aspect_ratio="2.0" clip="false" density="" fixed_ratio="" fixed_size="" flip="true" max_size="38.46" min_size="16.0" offset="0.5" step="16.0" variance="0.1,0.1,0.2,0.2"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
<dim>2</dim> <!-- values: [24, 42] -->
|
||||
|
@ -80,7 +80,7 @@
|
||||
|
||||
* *cube_coeff*
|
||||
|
||||
* **Description**: *cube_coeff* specifies the parameter *a* for cubic interpolation (see, e.g. [article](https://ieeexplore.ieee.org/document/1163711/)). *cube_coeff* is used only when `mode == cubic`.
|
||||
* **Description**: *cube_coeff* specifies the parameter *a* for cubic interpolation (see, e.g. [article](https://ieeexplore.ieee.org/document/1163711/)). *cube_coeff* is used only when `mode == cubic`.
|
||||
* **Range of values**: floating point number
|
||||
* **Type**: any of supported floating point type
|
||||
* **Default value**: `-0.75`
|
||||
|
@ -48,9 +48,9 @@
|
||||
* **Default value**: None
|
||||
* **Required**: *yes*
|
||||
|
||||
* *exclude_pad*
|
||||
* *exclude-pad*
|
||||
|
||||
* **Description**: *exclude_pad* is a type of pooling strategy for values in the padding area. For example, if *exclude_pad* is "true", then zero-values that came from padding are not included in averaging calculation.
|
||||
* **Description**: *exclude-pad* is a type of pooling strategy for values in the padding area. For example, if *exclude-pad* is "true", then zero-values that came from padding are not included in averaging calculation.
|
||||
* **Range of values**: true or false
|
||||
* **Type**: boolean
|
||||
* **Default value**: None
|
||||
@ -94,7 +94,7 @@ output_{j} = \frac{\sum_{i = 0}^{n}x_{i}}{n}
|
||||
|
||||
```xml
|
||||
<layer ... type="AvgPool" ... >
|
||||
<data auto_pad="same_upper" exclude_pad="true" kernel="2,2" pads_begin="0,0" pads_end="1,1" strides="2,2"/>
|
||||
<data auto_pad="same_upper" exclude-pad="true" kernel="2,2" pads_begin="0,0" pads_end="1,1" strides="2,2"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
<dim>1</dim>
|
||||
@ -114,7 +114,7 @@ output_{j} = \frac{\sum_{i = 0}^{n}x_{i}}{n}
|
||||
</layer>
|
||||
|
||||
<layer ... type="AvgPool" ... >
|
||||
<data auto_pad="same_upper" exclude_pad="false" kernel="5,5" pads_begin="0,0" pads_end="1,1" strides="2,2"/>
|
||||
<data auto_pad="same_upper" exclude-pad="false" kernel="5,5" pads_begin="0,0" pads_end="1,1" strides="2,2"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
<dim>1</dim>
|
||||
@ -134,7 +134,7 @@ output_{j} = \frac{\sum_{i = 0}^{n}x_{i}}{n}
|
||||
</layer>
|
||||
|
||||
<layer ... type="AvgPool" ... >
|
||||
<data auto_pad="explicit" exclude_pad="true" kernel="5,5" pads_begin="1,1" pads_end="1,1" strides="3,3"/>
|
||||
<data auto_pad="explicit" exclude-pad="true" kernel="5,5" pads_begin="1,1" pads_end="1,1" strides="3,3"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
<dim>1</dim>
|
||||
@ -154,7 +154,7 @@ output_{j} = \frac{\sum_{i = 0}^{n}x_{i}}{n}
|
||||
</layer>
|
||||
|
||||
<layer ... type="AvgPool" ... >
|
||||
<data auto_pad="explicit" exclude_pad="false" kernel="5,5" pads_begin="1,1" pads_end="1,1" strides="2,2"/>
|
||||
<data auto_pad="explicit" exclude-pad="false" kernel="5,5" pads_begin="1,1" pads_end="1,1" strides="2,2"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
<dim>1</dim>
|
||||
@ -174,7 +174,7 @@ output_{j} = \frac{\sum_{i = 0}^{n}x_{i}}{n}
|
||||
</layer>
|
||||
|
||||
<layer ... type="AvgPool" ... >
|
||||
<data auto_pad="valid" exclude_pad="true" kernel="5,5" pads_begin="1,1" pads_end="1,1" strides="2,2"/>
|
||||
<data auto_pad="valid" exclude-pad="true" kernel="5,5" pads_begin="1,1" pads_end="1,1" strides="2,2"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
<dim>1</dim>
|
||||
|
@ -19,9 +19,9 @@ Sequences in the batch can have different length. The lengths of sequences are c
|
||||
|
||||
**Attributes**
|
||||
|
||||
* *merge_repeated*
|
||||
* *ctc_merge_repeated*
|
||||
|
||||
* **Description**: *merge_repeated* is a flag for merging repeated labels during the CTC calculation.
|
||||
* **Description**: *ctc_merge_repeated* is a flag for merging repeated labels during the CTC calculation.
|
||||
* **Range of values**: true or false
|
||||
* **Type**: `boolean`
|
||||
* **Default value**: true
|
||||
@ -41,6 +41,7 @@ Sequences in the batch can have different length. The lengths of sequences are c
|
||||
|
||||
```xml
|
||||
<layer ... type="CTCGreedyDecoder" ...>
|
||||
<data ctc_merge_repeated="true" />
|
||||
<input>
|
||||
<port id="0">
|
||||
<dim>20</dim>
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -31,7 +31,7 @@ class PoolingFrontExtractor(FrontExtractorOp):
|
||||
param = proto_layer.pooling_param
|
||||
|
||||
method = 'max'
|
||||
exclude_pad = 'true'
|
||||
exclude_pad = True
|
||||
kernel = [0, 0]
|
||||
stride = [1, 1]
|
||||
padding = [0, 0]
|
||||
@ -46,10 +46,10 @@ class PoolingFrontExtractor(FrontExtractorOp):
|
||||
|
||||
if param.pool == 0:
|
||||
method = 'max'
|
||||
exclude_pad = 'true'
|
||||
exclude_pad = True
|
||||
elif param.pool == 1:
|
||||
method = 'avg'
|
||||
exclude_pad = 'false'
|
||||
exclude_pad = False
|
||||
else:
|
||||
raise ValueError('Unknown Pooling Method!')
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -36,7 +36,7 @@ class TestPooling(unittest.TestCase):
|
||||
'stride': 2,
|
||||
'pad': 3,
|
||||
'pool': 0,
|
||||
'global_pooling': 1,
|
||||
'global_pooling': True,
|
||||
'ceil_mode': 1
|
||||
}
|
||||
node = PB({'pb': FakeProtoLayer(FakeMultiParam(params))})
|
||||
@ -48,9 +48,9 @@ class TestPooling(unittest.TestCase):
|
||||
'pad': np.array([[0, 0], [0, 0], [0, 0], [0, 0]], dtype=np.int64),
|
||||
'pad_spatial_shape': np.array([[0, 0], [0, 0]], dtype=np.int64),
|
||||
'pool_method': 'max',
|
||||
'exclude_pad': 'true',
|
||||
'exclude_pad': True,
|
||||
'infer': Pooling.infer,
|
||||
'global_pool': 1,
|
||||
'global_pool': True,
|
||||
'output_spatial_shape': None,
|
||||
'pooling_convention': 'full',
|
||||
'rounding_type': 'ceil'
|
||||
@ -72,7 +72,7 @@ class TestPooling(unittest.TestCase):
|
||||
'stride': 2,
|
||||
'pad': 3,
|
||||
'pool': 1,
|
||||
'global_pooling': 0,
|
||||
'global_pooling': False,
|
||||
'ceil_mode': 0
|
||||
}
|
||||
node = PB({'pb': FakeProtoLayer(FakeMultiParam(params))})
|
||||
@ -84,9 +84,9 @@ class TestPooling(unittest.TestCase):
|
||||
'pad': np.array([[0, 0], [0, 0], [3, 3], [3, 3]], dtype=np.int64),
|
||||
'pad_spatial_shape': np.array([[3, 3], [3, 3]], dtype=np.int64),
|
||||
'pool_method': 'avg',
|
||||
'exclude_pad': 'false',
|
||||
'exclude_pad': False,
|
||||
'infer': Pooling.infer,
|
||||
'global_pool': 0,
|
||||
'global_pool': False,
|
||||
'output_spatial_shape': None,
|
||||
'pooling_convention': 'valid'
|
||||
}
|
||||
@ -106,7 +106,7 @@ class TestPooling(unittest.TestCase):
|
||||
'stride': 2,
|
||||
'pad': 3,
|
||||
'pool': 3,
|
||||
'global_pooling': 1
|
||||
'global_pooling': True
|
||||
}
|
||||
node = PB({'pb': FakeProtoLayer(FakeMultiParam(params))})
|
||||
self.assertRaises(ValueError, PoolingFrontExtractor.extract, node)
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -41,7 +41,7 @@ class PoolingFrontExtractor(FrontExtractorOp):
|
||||
'pad': np.array([[0, 0], [0, 0], *[[pad, pad] for pad in padding]], dtype=np.int64),
|
||||
'pad_spatial_shape': np.array([[pad, pad] for pad in padding], dtype=np.int64),
|
||||
'pool_method': method,
|
||||
'exclude_pad': 'false',
|
||||
'exclude_pad': False,
|
||||
'output_spatial_shape': None,
|
||||
'spatial_dims': None,
|
||||
'channel_dims': np.array([1], dtype=np.int64),
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -40,7 +40,7 @@ class TestPoolingShapesParsing(unittest.TestCase):
|
||||
'stride': np.array([1, 1, 3, 2]),
|
||||
'window': np.array([1, 1, 3, 4]),
|
||||
'pool_method': 'max',
|
||||
'exclude_pad': 'false',
|
||||
'exclude_pad': False,
|
||||
}
|
||||
|
||||
for key in exp_res.keys():
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -112,7 +112,7 @@ def common_onnx_pool_extractor(node):
|
||||
# exclude_pad = True only when count_include_pad == 0
|
||||
exclude_pad = onnx_attr(node, 'count_include_pad', 'i', default=0) == 0
|
||||
|
||||
global_pooling = 0
|
||||
global_pooling = False
|
||||
if node.op in ['MaxPool', 'GlobalMaxPool']:
|
||||
method = 'max'
|
||||
elif node.op in ['AveragePool', 'GlobalAveragePool']:
|
||||
@ -136,7 +136,7 @@ def common_onnx_pool_extractor(node):
|
||||
'pad': final_pads,
|
||||
'pad_spatial_shape': np.array(pads, dtype=np.int64) if pads is not None else None,
|
||||
'pool_method': method,
|
||||
'exclude_pad': 'true' if exclude_pad else 'false',
|
||||
'exclude_pad': True if exclude_pad else False,
|
||||
'global_pool': global_pooling,
|
||||
'output_spatial_shape': None,
|
||||
'rounding_type': rt,
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -86,6 +86,6 @@ def create_pooling_attrs(node, pool_method):
|
||||
'pool_method': pool_method,
|
||||
'type': 'Pooling',
|
||||
'layout': data_format.s.decode(),
|
||||
'exclude_pad': 'true',
|
||||
'exclude_pad': True,
|
||||
}
|
||||
return attrs
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -48,7 +48,7 @@ class PoolingExtractorTest(BaseExtractorsTestingClass):
|
||||
'pad': None, # will be inferred when input shape is known
|
||||
'pad_spatial_shape': None,
|
||||
'type': 'Pooling',
|
||||
'exclude_pad': 'true',
|
||||
'exclude_pad': True,
|
||||
}
|
||||
node = PB({'pb': pb})
|
||||
AvgPoolFrontExtractor.extract(node)
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -16,6 +16,7 @@
|
||||
import numpy as np
|
||||
|
||||
from mo.front.common.partial_infer.multi_box_detection import multi_box_detection_infer
|
||||
from mo.front.extractor import bool_to_str
|
||||
from mo.graph.graph import Graph, Node
|
||||
from mo.ops.op import Op
|
||||
|
||||
@ -34,48 +35,32 @@ class DetectionOutput(Op):
|
||||
'infer': multi_box_detection_infer,
|
||||
'input_width': 1,
|
||||
'input_height': 1,
|
||||
'normalized': 1,
|
||||
'share_location': 1,
|
||||
'variance_encoded_in_target': 0,
|
||||
'normalized': True,
|
||||
'share_location': True,
|
||||
'clip_after_nms': False,
|
||||
'clip_before_nms': False,
|
||||
'decrease_label_id': False,
|
||||
'variance_encoded_in_target': False,
|
||||
'type_infer': self.type_infer,
|
||||
}, attrs)
|
||||
|
||||
def supported_attrs(self):
|
||||
return [
|
||||
'background_label_id',
|
||||
'clip_after_nms',
|
||||
'clip_before_nms',
|
||||
('clip_after_nms', lambda node: bool_to_str(node, 'clip_after_nms')),
|
||||
('clip_before_nms', lambda node: bool_to_str(node, 'clip_before_nms')),
|
||||
'code_type',
|
||||
'confidence_threshold',
|
||||
'decrease_label_id',
|
||||
'eta',
|
||||
'height',
|
||||
'height_scale',
|
||||
('decrease_label_id', lambda node: bool_to_str(node, 'decrease_label_id')),
|
||||
'input_height',
|
||||
'input_width',
|
||||
'interp_mode',
|
||||
'keep_top_k',
|
||||
'label_map_file',
|
||||
'name_size_file',
|
||||
'nms_threshold',
|
||||
'normalized',
|
||||
('normalized', lambda node: bool_to_str(node, 'normalized')),
|
||||
'num_classes',
|
||||
'num_test_image',
|
||||
'output_directory',
|
||||
'output_format',
|
||||
'output_name_prefix',
|
||||
'pad_mode',
|
||||
'pad_value',
|
||||
'prob',
|
||||
'resize_mode',
|
||||
'save_file',
|
||||
'share_location',
|
||||
('share_location', lambda node: bool_to_str(node, 'share_location')),
|
||||
'top_k',
|
||||
'variance_encoded_in_target',
|
||||
'visualize',
|
||||
'visualize_threshold',
|
||||
'width',
|
||||
'width_scale',
|
||||
('variance_encoded_in_target', lambda node: bool_to_str(node, 'variance_encoded_in_target')),
|
||||
'objectness_score',
|
||||
]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -14,6 +14,7 @@
|
||||
limitations under the License.
|
||||
"""
|
||||
from mo.front.common.partial_infer.utils import mark_input_bins
|
||||
from mo.front.extractor import bool_to_str
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.ops.op import Op
|
||||
from mo.utils.error import Error
|
||||
@ -39,13 +40,13 @@ class GRUCell(Op):
|
||||
mandatory_props = {
|
||||
'type': __class__.op,
|
||||
'op': __class__.op,
|
||||
'version': 'experimental',
|
||||
'infer': __class__.infer,
|
||||
'in_ports_count': 4,
|
||||
'out_ports_count': 1,
|
||||
'version': 'opset3',
|
||||
'wr_input_id': 2,
|
||||
'gates_count': 3
|
||||
'gates_count': 3,
|
||||
'linear_before_reset': False,
|
||||
}
|
||||
super().__init__(graph, mandatory_props, attrs)
|
||||
|
||||
@ -66,7 +67,7 @@ class GRUCell(Op):
|
||||
'activation_alpha',
|
||||
'activation_beta',
|
||||
'clip',
|
||||
'linear_before_reset',
|
||||
('linear_before_reset', lambda node: bool_to_str(node, 'linear_before_reset')),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -19,6 +19,7 @@ import logging as log
|
||||
import numpy as np
|
||||
|
||||
from mo.front.common.partial_infer.utils import assign_dims_to_weights, int64_array
|
||||
from mo.front.extractor import bool_to_str
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.ops.op import Op
|
||||
|
||||
@ -44,8 +45,8 @@ class MatMul(Op):
|
||||
|
||||
def supported_attrs(self):
|
||||
return [
|
||||
'transpose_a',
|
||||
'transpose_b',
|
||||
('transpose_a', lambda node: bool_to_str(node, 'transpose_a')),
|
||||
('transpose_b', lambda node: bool_to_str(node, 'transpose_b')),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -17,6 +17,7 @@
|
||||
import numpy as np
|
||||
|
||||
from mo.front.common.partial_infer.utils import int64_array
|
||||
from mo.front.extractor import bool_to_str
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.graph.perm_inputs import PermuteInputs
|
||||
from mo.ops.op import Op
|
||||
@ -106,7 +107,7 @@ class ReduceOp(Op):
|
||||
|
||||
def supported_attrs(self):
|
||||
return [
|
||||
('keep_dims', lambda node: str(node.keep_dims)),
|
||||
('keep_dims', lambda node: bool_to_str(node, 'keep_dims')),
|
||||
]
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -55,7 +55,7 @@ class AdaptiveAvgPooling(Op):
|
||||
'pad': int64_array([[0, 0], [0, 0], [0, 0], [0, 0]]),
|
||||
'pad_spatial_shape': int64_array([[0, 0], [0, 0]]),
|
||||
'pool_method': 'avg',
|
||||
'exclude_pad': 'false',
|
||||
'exclude_pad': False,
|
||||
'output_spatial_shape': None,
|
||||
'spatial_dims': None,
|
||||
'channel_dims': int64_array([1]),
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
import numpy as np
|
||||
|
||||
from mo.front.extractor import bool_to_str
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.middle.passes.convert_data_type import np_data_type_to_destination_type
|
||||
from mo.ops.op import Op
|
||||
@ -42,10 +43,10 @@ class Bucketize(Op):
|
||||
def backend_attrs(self):
|
||||
version = self.get_opset()
|
||||
if version == "extension":
|
||||
return ['with_right_bound']
|
||||
return [('with_right_bound', lambda node: bool_to_str(node, 'with_right_bound'))]
|
||||
else:
|
||||
return [
|
||||
'with_right_bound',
|
||||
('with_right_bound', lambda node: bool_to_str(node, 'with_right_bound')),
|
||||
('output_type', lambda node: np_data_type_to_destination_type(node.output_type)),
|
||||
]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -15,6 +15,7 @@
|
||||
"""
|
||||
|
||||
from mo.front.common.partial_infer.utils import int64_array
|
||||
from mo.front.extractor import bool_to_str
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.ops.op import Op
|
||||
|
||||
@ -32,13 +33,15 @@ class CTCGreedyDecoderOp(Op):
|
||||
'reinterp_shape': True,
|
||||
|
||||
'in_ports_count': 2,
|
||||
'out_ports_count': 1
|
||||
'out_ports_count': 1,
|
||||
|
||||
'ctc_merge_repeated': True
|
||||
}
|
||||
super().__init__(graph, mandatory_props, attrs)
|
||||
|
||||
def supported_attrs(self):
|
||||
return [
|
||||
'ctc_merge_repeated'
|
||||
('ctc_merge_repeated', lambda node: bool_to_str(node, 'ctc_merge_repeated'))
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2020 Intel Corporation
|
||||
Copyright (C) 2020-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.
|
||||
@ -17,6 +17,7 @@
|
||||
import numpy as np
|
||||
|
||||
from mo.front.common.partial_infer.utils import int64_array
|
||||
from mo.front.extractor import bool_to_str
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.ops.op import Op
|
||||
|
||||
@ -35,11 +36,17 @@ class CTCLoss(Op):
|
||||
|
||||
'in_ports_count': 5,
|
||||
'out_ports_count': 1,
|
||||
|
||||
'preprocess_collapse_repeated': False,
|
||||
'ctc_merge_repeated': True,
|
||||
'unique': False
|
||||
}
|
||||
super().__init__(graph, mandatory_props, attrs)
|
||||
|
||||
def backend_attrs(self):
|
||||
return ['preprocess_collapse_repeated', 'ctc_merge_repeated', 'unique']
|
||||
return [('preprocess_collapse_repeated', lambda node: bool_to_str(node, 'preprocess_collapse_repeated')),
|
||||
('ctc_merge_repeated', lambda node: bool_to_str(node, 'ctc_merge_repeated')),
|
||||
('unique', lambda node: bool_to_str(node, 'unique'))]
|
||||
|
||||
@staticmethod
|
||||
def type_infer(node):
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -15,6 +15,7 @@
|
||||
"""
|
||||
import numpy as np
|
||||
|
||||
from mo.front.extractor import bool_to_str
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.ops.op import Op
|
||||
|
||||
@ -48,7 +49,8 @@ class CumSum(Op):
|
||||
}, attrs)
|
||||
|
||||
def supported_attrs(self):
|
||||
return ["exclusive", "reverse"]
|
||||
return [('exclusive', lambda node: bool_to_str(node, 'exclusive')),
|
||||
('reverse', lambda node: bool_to_str(node, 'reverse'))]
|
||||
|
||||
@staticmethod
|
||||
def infer(node: Node):
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -16,9 +16,11 @@
|
||||
|
||||
|
||||
import math
|
||||
|
||||
import numpy as np
|
||||
|
||||
from mo.front.common.partial_infer.utils import int64_array
|
||||
from mo.front.extractor import bool_to_str
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.ops.op import Op, PermuteAttrs
|
||||
|
||||
@ -116,11 +118,14 @@ class Interpolate(Op):
|
||||
self.attributes_for_opsets = {
|
||||
'opset1': [
|
||||
('axes', lambda node: ','.join(map(str, node.axes))),
|
||||
'mode', 'align_corners', 'antialias', 'pads_begin', 'pads_end',
|
||||
('antialias', lambda node: bool_to_str(node, 'antialias')),
|
||||
('align_corners', lambda node: bool_to_str(node, 'align_corners')),
|
||||
'mode', 'pads_begin', 'pads_end',
|
||||
],
|
||||
'opset4': [
|
||||
'mode', 'antialias', 'nearest_mode', 'cube_coeff', 'coordinate_transformation_mode',
|
||||
'mode', 'nearest_mode', 'cube_coeff', 'coordinate_transformation_mode',
|
||||
'shape_calculation_mode',
|
||||
('antialias', lambda node: bool_to_str(node, 'antialias')),
|
||||
('pads_begin', lambda node: pad_attribute_to_str(node, 'pads_begin')),
|
||||
('pads_end', lambda node: pad_attribute_to_str(node, 'pads_end')),
|
||||
]
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -13,9 +13,10 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
from mo.front.caffe.extractors.utils import get_canonical_axis_index
|
||||
from mo.front.common.layout import get_features_dim
|
||||
from mo.front.common.partial_infer.elemental import copy_shape_infer
|
||||
from mo.front.caffe.extractors.utils import get_canonical_axis_index
|
||||
from mo.front.extractor import bool_to_str
|
||||
from mo.graph.graph import Graph
|
||||
from mo.ops.op import Op
|
||||
from mo.utils.error import Error
|
||||
@ -44,7 +45,9 @@ class MVN(Op):
|
||||
return ['eps', 'across_channels', 'normalize_variance', 'axes']
|
||||
|
||||
def backend_attrs(self):
|
||||
return ['eps', 'across_channels', 'normalize_variance']
|
||||
return ['eps',
|
||||
('across_channels', lambda node: bool_to_str(node, 'across_channels')),
|
||||
('normalize_variance', lambda node: bool_to_str(node, 'normalize_variance'))]
|
||||
|
||||
@staticmethod
|
||||
def infer(node: None):
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -18,6 +18,7 @@ import logging as log
|
||||
import numpy as np
|
||||
|
||||
from mo.front.common.partial_infer.utils import int64_array
|
||||
from mo.front.extractor import bool_to_str
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.middle.passes.convert_data_type import np_data_type_to_destination_type
|
||||
from mo.ops.op import Op
|
||||
@ -53,10 +54,12 @@ class NonMaxSuppression(Op):
|
||||
def backend_attrs(self):
|
||||
version = self.get_opset()
|
||||
if version in ['opset3', 'opset4', 'opset5']:
|
||||
return ['sort_result_descending', 'box_encoding',
|
||||
return [('sort_result_descending', lambda node: bool_to_str(node, 'sort_result_descending')),
|
||||
'box_encoding',
|
||||
('output_type', lambda node: np_data_type_to_destination_type(node.output_type))]
|
||||
elif version == 'opset1':
|
||||
return ['sort_result_descending', 'box_encoding']
|
||||
return [('sort_result_descending', lambda node: bool_to_str(node, 'sort_result_descending')),
|
||||
'box_encoding']
|
||||
else:
|
||||
raise Error('Unsupported operation opset version "{}"'.format(version))
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -17,7 +17,7 @@
|
||||
import numpy as np
|
||||
|
||||
from mo.front.common.layout import get_width_dim, get_height_dim
|
||||
from mo.front.extractor import attr_getter
|
||||
from mo.front.extractor import attr_getter, bool_to_str
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.ops.op import Op
|
||||
|
||||
@ -30,7 +30,9 @@ class PriorBoxOp(Op):
|
||||
'type': self.op,
|
||||
'op': self.op,
|
||||
'version': 'opset1',
|
||||
'flip': 1,
|
||||
'flip': True,
|
||||
'clip': True,
|
||||
'scale_all_sizes': True,
|
||||
'max_size': np.array([]),
|
||||
'min_size': np.array([]),
|
||||
'aspect_ratio': np.array([]),
|
||||
@ -66,11 +68,11 @@ class PriorBoxOp(Op):
|
||||
|
||||
def backend_attrs(self):
|
||||
return [
|
||||
'flip',
|
||||
'clip',
|
||||
('flip', lambda node: bool_to_str(node, 'flip')),
|
||||
('clip', lambda node: bool_to_str(node, 'clip')),
|
||||
'step',
|
||||
'offset',
|
||||
'scale_all_sizes',
|
||||
('scale_all_sizes', lambda node: bool_to_str(node, 'scale_all_sizes')),
|
||||
('min_size', lambda node: attr_getter(node, 'min_size')),
|
||||
('max_size', lambda node: attr_getter(node, 'max_size')),
|
||||
('aspect_ratio', lambda node: attr_getter(node, 'aspect_ratio')),
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -17,7 +17,7 @@
|
||||
import numpy as np
|
||||
|
||||
from mo.front.common.layout import get_width_dim, get_height_dim
|
||||
from mo.front.extractor import attr_getter
|
||||
from mo.front.extractor import attr_getter, bool_to_str
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.ops.op import Op
|
||||
|
||||
@ -34,6 +34,7 @@ class PriorBoxClusteredOp(Op):
|
||||
'out_ports_count': 1,
|
||||
'infer': self.priorbox_clustered_infer,
|
||||
'type_infer': self.type_infer,
|
||||
'clip': True,
|
||||
}
|
||||
super().__init__(graph, mandatory_props, attrs)
|
||||
|
||||
@ -55,9 +56,7 @@ class PriorBoxClusteredOp(Op):
|
||||
|
||||
def backend_attrs(self):
|
||||
return [
|
||||
'flip',
|
||||
'clip',
|
||||
'img_size',
|
||||
('clip', lambda node: bool_to_str(node, 'clip')),
|
||||
'img_h',
|
||||
'img_w',
|
||||
'step',
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -15,7 +15,7 @@
|
||||
"""
|
||||
|
||||
from mo.front.common.partial_infer.utils import int64_array
|
||||
from mo.front.extractor import attr_getter
|
||||
from mo.front.extractor import attr_getter, bool_to_str
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.ops.op import Op
|
||||
|
||||
@ -32,7 +32,9 @@ class ProposalOp(Op):
|
||||
'infer': ProposalOp.proposal_infer,
|
||||
'in_ports_count': 3,
|
||||
'out_ports_count': 2,
|
||||
'normalize': 0,
|
||||
'normalize': False,
|
||||
'clip_before_nms': True,
|
||||
'clip_after_nms': False,
|
||||
}
|
||||
super().__init__(graph, mandatory_props, attrs)
|
||||
|
||||
@ -61,9 +63,9 @@ class ProposalOp(Op):
|
||||
'framework',
|
||||
'box_coordinate_scale',
|
||||
'box_size_scale',
|
||||
'normalize',
|
||||
'clip_after_nms',
|
||||
'clip_before_nms',
|
||||
('normalize', lambda node: bool_to_str(node, 'normalize')),
|
||||
('clip_after_nms', lambda node: bool_to_str(node, 'clip_after_nms')),
|
||||
('clip_before_nms', lambda node: bool_to_str(node, 'clip_before_nms')),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -45,8 +45,6 @@ class PSROIPoolingOp(Op):
|
||||
'mode',
|
||||
'spatial_bins_x',
|
||||
'spatial_bins_y',
|
||||
'pooled_width',
|
||||
'pooled_height',
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -18,7 +18,7 @@ import numpy as np
|
||||
|
||||
from mo.front.caffe.extractors.utils import get_canonical_axis_index
|
||||
from mo.front.common.layout import get_batch_dim, get_height_dim, get_width_dim, shape_for_layout
|
||||
from mo.front.extractor import attr_getter
|
||||
from mo.front.extractor import attr_getter, bool_to_str
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.ops.op import Op
|
||||
|
||||
@ -56,7 +56,7 @@ class RegionYoloOp(Op):
|
||||
'num',
|
||||
'axis',
|
||||
'end_axis',
|
||||
'do_softmax',
|
||||
('do_softmax', lambda node: bool_to_str(node, 'do_softmax')),
|
||||
('anchors', lambda node: attr_getter(node, 'anchors')),
|
||||
('mask', lambda node: attr_getter(node, 'mask'))
|
||||
]
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -131,6 +131,20 @@ def attr_getter(node: Node, name: str):
|
||||
return None
|
||||
|
||||
|
||||
def bool_to_str(node: Node, attr: str):
|
||||
# Function converts 0/1 or bool False/True values to str 'false'/'true' which need to appear in IR
|
||||
attribute_name = node.soft_get(attr, None)
|
||||
if attribute_name is None:
|
||||
return None
|
||||
if isinstance(attribute_name, bool):
|
||||
return str(attribute_name).lower()
|
||||
elif attribute_name in [0, 1]:
|
||||
return str(bool(attribute_name)).lower()
|
||||
else:
|
||||
raise Error('Wrong value {} for boolean attribute {} in node {}'.format(
|
||||
attribute_name, attr, node.soft_get('name')))
|
||||
|
||||
|
||||
def kernel_getter(node: Node, dim: int):
|
||||
if node.kind == 'op' and node.op in ['Conv2D', 'DepthwiseConv2dNative', 'Deconv2D']:
|
||||
if node.has('kernel_spatial'):
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -22,7 +22,7 @@ from generator import generator, generate
|
||||
from mo.front.extractor import input_user_data_repack, output_user_data_repack, update_ie_fields, add_input_op, \
|
||||
get_node_id_with_ports
|
||||
from mo.front.extractor import spatial_attr_getter, add_input_ops, attr_getter, CaffePythonFrontExtractorOp, \
|
||||
add_output_ops
|
||||
add_output_ops, bool_to_str
|
||||
from mo.graph.graph import Node
|
||||
from mo.utils.error import Error
|
||||
from mo.utils.ir_engine.compare_graphs import compare_graphs
|
||||
@ -672,3 +672,18 @@ class TestCaffePythonFrontExtractorOp(unittest.TestCase):
|
||||
param_str = "'test_attr_1': 12, 'test_attr_2': 'sdf sdf'"
|
||||
attrs = CaffePythonFrontExtractorOp.get_attrs(FakePythonParam(FakeMultiParam({'param_str': param_str})))
|
||||
self.assertEqual(exp_attrs, attrs)
|
||||
|
||||
class TestBoolToSrtFunction(unittest.TestCase):
|
||||
def test_bool_to_str(self):
|
||||
graph = build_graph(nodes_attributes,
|
||||
[('input', 'pool_1'),
|
||||
('pool_1', 'output'),
|
||||
('output', 'op_output')
|
||||
],
|
||||
{'pool_1': {'bool_attr': None}
|
||||
})
|
||||
pool_1_node = Node(graph, 'pool_1')
|
||||
attrs = [(True, 'true'), (False, 'false'), (1, 'true'), (0, 'false')]
|
||||
for attr in attrs:
|
||||
pool_1_node.bool_attr = attr[0]
|
||||
self.assertEqual(attr[1], bool_to_str(pool_1_node, 'bool_attr'))
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -28,6 +28,8 @@ class DeformableConvolution(Op):
|
||||
'op': __class__.op,
|
||||
'version': 'opset1',
|
||||
'infer': Convolution.infer,
|
||||
'group': 1,
|
||||
'deformable_group': 1,
|
||||
'multiplication_transparent': True,
|
||||
'multiplication_transparent_ports': [(0, 0), (2, 0)],
|
||||
'in_ports_count': 3,
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -21,6 +21,7 @@ from mo.front.onnx.extractors.utils import get_backend_pad
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.ops.op import Op, PermuteAttrs
|
||||
from mo.utils.error import Error
|
||||
from mo.front.extractor import bool_to_str
|
||||
|
||||
|
||||
class Pooling(Op):
|
||||
@ -44,8 +45,7 @@ class Pooling(Op):
|
||||
('pads_begin', lambda node: ','.join(map(str, get_backend_pad(node.pad, node.spatial_dims, 0)))),
|
||||
('pads_end', lambda node: ','.join(map(str, get_backend_pad(node.pad, node.spatial_dims, 1)))),
|
||||
|
||||
('pool-method', 'pool_method'),
|
||||
('exclude-pad', 'exclude_pad'),
|
||||
('exclude-pad', lambda node: bool_to_str(node, 'exclude_pad')),
|
||||
|
||||
'rounding_type',
|
||||
('auto_pad', lambda node: node.auto_pad if node.has_valid('auto_pad') else 'explicit'),
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -42,7 +42,7 @@ class TestPoolingPartialInfer(unittest.TestCase):
|
||||
'pool': {'window': np.array([1, 1, 1, 1]), 'stride': np.array([1, 1, 2, 2]),
|
||||
'pad': np.array([[0, 0], [0, 0], [3, 3], [3, 3]]),
|
||||
'pad_spatial_shape': np.array([[3, 3], [3, 3]]),
|
||||
'pool_method': 'avg', 'exclude_pad': 'false', 'global_pool': 0,
|
||||
'pool_method': 'avg', 'exclude_pad': False, 'global_pool': False,
|
||||
'output_spatial_shape': None, 'output_shape': None,
|
||||
'kernel_spatial': np.array([3, 3]), 'spatial_dims': np.array([2, 3]),
|
||||
'channel_dims': np.array([1]), 'batch_dims': np.array([0]),
|
||||
@ -68,7 +68,7 @@ class TestPoolingPartialInfer(unittest.TestCase):
|
||||
'pool': {'window': np.array([1, 1, 1, 1]), 'stride': np.array([1, 1, 3, 3]),
|
||||
'pad': np.array([[0, 0], [0, 0], [3, 3], [3, 3]]),
|
||||
'pad_spatial_shape': np.array([[1, 1], [1, 1]]),
|
||||
'pool_method': 'avg', 'exclude_pad': 'false', 'global_pool': 0,
|
||||
'pool_method': 'avg', 'exclude_pad': False, 'global_pool': False,
|
||||
'output_spatial_shape': None, 'output_shape': None,
|
||||
'kernel_spatial': np.array([3, 3]), 'spatial_dims': np.array([2, 3]),
|
||||
'channel_dims': np.array([1]), 'batch_dims': np.array([0]),
|
||||
@ -94,7 +94,7 @@ class TestPoolingPartialInfer(unittest.TestCase):
|
||||
'pool': {'window': np.array([1, 1, 1, 1]), 'stride': np.array([1, 1, 2, 2]),
|
||||
'pad': np.array([[0, 0], [0, 0], [3, 3], [3, 3]]),
|
||||
'pad_spatial_shape': np.array([[3, 3], [3, 3]]),
|
||||
'pool_method': 'avg', 'exclude_pad': 'false', 'global_pool': 0,
|
||||
'pool_method': 'avg', 'exclude_pad': False, 'global_pool': False,
|
||||
'output_spatial_shape': None, 'output_shape': None,
|
||||
'kernel_spatial': np.array([3, 3]), 'spatial_dims': np.array([2, 3]),
|
||||
'channel_dims': np.array([1]), 'batch_dims': np.array([0])}
|
||||
@ -119,7 +119,7 @@ class TestPoolingPartialInfer(unittest.TestCase):
|
||||
'pool': {'window': np.array([1, 1, 1, 1]), 'stride': np.array([1, 1, 2, 2]),
|
||||
'pad': np.array([[0, 0], [0, 0], [3, 3], [3, 3]]),
|
||||
'pad_spatial_shape': np.array([[3, 3], [3, 3]]),
|
||||
'pool_method': 'avg', 'exclude_pad': 'false',
|
||||
'pool_method': 'avg', 'exclude_pad': False,
|
||||
'output_spatial_shape': None, 'output_shape': None,
|
||||
'kernel_spatial': np.array([3, 3]), 'spatial_dims': np.array([2, 3]),
|
||||
'channel_dims': np.array([1]), 'batch_dims': np.array([0]),
|
||||
@ -142,7 +142,7 @@ class TestPoolingPartialInfer(unittest.TestCase):
|
||||
'pool': {'window': np.array([1, 1, 5, 5]), 'stride': np.array([1, 1, 2, 2]),
|
||||
'pad': np.array([[0, 0], [0, 0], [1, 1], [1, 1]]),
|
||||
'pad_spatial_shape': np.array([[1, 1], [1, 1]]),
|
||||
'pool_method': 'avg', 'exclude_pad': 'false', 'global_pool': 0,
|
||||
'pool_method': 'avg', 'exclude_pad': False, 'global_pool': False,
|
||||
'output_spatial_shape': None, 'output_shape': None,
|
||||
'kernel_spatial': np.array([3, 3]), 'spatial_dims': np.array([2, 3]),
|
||||
'channel_dims': np.array([1]), 'batch_dims': np.array([0]),
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -15,6 +15,7 @@
|
||||
"""
|
||||
import numpy as np
|
||||
|
||||
from mo.front.extractor import bool_to_str
|
||||
from mo.graph.graph import Node, Graph
|
||||
from mo.graph.perm_inputs import PermuteInputs
|
||||
from mo.ops.op import Op
|
||||
@ -40,7 +41,7 @@ class Reshape(Op):
|
||||
}, attrs)
|
||||
|
||||
def supported_attrs(self):
|
||||
return ['special_zero']
|
||||
return [('special_zero', lambda node: bool_to_str(node, 'special_zero'))]
|
||||
|
||||
@staticmethod
|
||||
def infer(node: Node):
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Copyright (C) 2018-2020 Intel Corporation
|
||||
Copyright (C) 2018-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.
|
||||
@ -30,6 +30,7 @@ class ROIPooling(Op):
|
||||
'pooled_h': None,
|
||||
'pooled_w': None,
|
||||
'spatial_scale': 0.0625,
|
||||
'method': 'max',
|
||||
'infer': roipooling_infer,
|
||||
'in_ports_count': 2,
|
||||
'out_ports_count': 1,
|
||||
|
Loading…
Reference in New Issue
Block a user