Skip to content

Commit

Permalink
[ MO ] Warnings fix (openvinotoolkit#5105)
Browse files Browse the repository at this point in the history
* warnings fix

* remove redundant backslash

* add whitespace in the error message
  • Loading branch information
yekruglov authored and mryzhov committed Apr 23, 2021
1 parent 413ed43 commit d782c76
Show file tree
Hide file tree
Showing 24 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions model-optimizer/extensions/back/InterpolateReshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


class InterpolateConcat(BackReplacementPattern):
"""
r"""
Replaces hard-coded 1-port input of Interpolate with reshape-able sub-graph using the following Concat inputs
BEFORE:
Expand Down Expand Up @@ -85,7 +85,7 @@ def find_and_replace_pattern(self, graph: Graph):


class InterpolateReshapeWA(BackReplacementPattern):
"""
r"""
Replaces hard-coded 1-port input of Interpolate with reshape-able sub-graph.
WARNING: Could cause troubles if model has hard-coded Interpolate intentionally -- rare situation
BEFORE:
Expand Down
4 changes: 2 additions & 2 deletions model-optimizer/extensions/back/MatMulNormalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def replace_pattern(graph: Graph, match: dict):


class PullTransposeThroughFQUp(BackReplacementPattern):
"""
r"""
BEFORE AFTER
T T T T T
\ \ | / / \ \ | / /
Expand Down Expand Up @@ -135,7 +135,7 @@ def replace_pattern(graph: Graph, match: dict):


class SmartReshape_HC_Reshape_MatMul(BackReplacementPattern):
"""
r"""
Relaxes hard-coded input of Reshape in such sub-graphs:
input_1 Constant
Expand Down
6 changes: 3 additions & 3 deletions model-optimizer/extensions/back/ReverseInputChannels.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class ReverseChannelsPropagationDown(BackReplacementPattern):

@staticmethod
def pass_rc_through_conv(node, reverse_channels):
"""
r"""
For non grouped convolution:
BEFORE AFTER
Expand Down Expand Up @@ -167,7 +167,7 @@ def pass_rc_through_conv(node, reverse_channels):

@staticmethod
def pass_rc_through_eltwise(node, reverse_channels):
"""
r"""
BEFORE AFTER
previous_op previous_op'
Expand Down Expand Up @@ -268,7 +268,7 @@ class ReverseChannelsPropagationUp(BackReplacementPattern):

@staticmethod
def lift_up_through_eltwise(node: Node, reverse_channels: Node):
"""
r"""
BEFORE AFTER
previous_op previous_op'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


class CompressQuantizeWeights(BackReplacementPattern):
"""
r"""
Compress weights transformation goal is to pre-quantize data to minimize runtime calculations with constant data.
To achieve this goal we perform FakeQuantize decomposition to separate quantization from dequantization in it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


class DropoutWithRandomUniformReplacer(FrontReplacementSubgraph):
"""
r"""
This transformation replaces possible Dropout block (in inference mode) with RandomUniform
to Broadcast of half-ones in a sub-graph.
WARNING: the transformation can be triggered for other block with RandomUniform by mistake,
Expand Down
2 changes: 1 addition & 1 deletion model-optimizer/extensions/front/broadcast_with_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class ExpandRangeConstant(FrontReplacementSubgraph):
"""
r"""
Searches for Constant operations filled with range values starting from 0 and replaces it with Range operation
Faced in ONNX BERT -- replacing it makes model reshape-able by sequence length
Expand Down
2 changes: 1 addition & 1 deletion model-optimizer/extensions/front/interpolate_reshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class InterpolateWithConcat(FrontReplacementPattern):
"""
r"""
Replaces hard-coded 1-port input of Interpolate with reshape-able sub-graph using the following Concat inputs
BEFORE:
Expand Down
2 changes: 1 addition & 1 deletion model-optimizer/extensions/front/kaldi/apply_counts.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


def apply_biases_to_last_layer(graph, counts):
"""
r"""
When user provides counts file, it is a file that contains log-apriory probabilities,
technically it should be subtracted from the bias of the last layer unless it is a SoftMax.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def align_frame_time(graph: Graph, node: Node, frame_time_max):


class MemoryOffsetAdjustment(FrontReplacementSubgraph):
"""
r"""
Pass used to fix wrong results in the following situation:
input
| \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class TdnnComponentReplacer(FrontReplacementPattern):
'''
r"""
Expand TdnnComponent into MemoryOffsets, Concat and FullyConected nodes
BEFORE:
Expand All @@ -31,7 +31,7 @@ class TdnnComponentReplacer(FrontReplacementPattern):
|
FullyConnected
|
'''
"""
enabled = True
run_not_recursively = True

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class NonConstBeginStridedSliceReplacement(FrontReplacementSubgraph):
"""
r"""
The transformation handles StridedSlice operation with dynamic begin and end values
when slicing performs along just one dimension with a dynamic index.
For example, StridedSlice with begin=(0,idx,0), end=(0,idx+1,0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


class UnpackPackReverseInputChannels(FrontReplacementSubgraph):
"""
r"""
Unpack - Pack nodes sequence from TensorFlow connected like it shown below is a way to ReverseChannels
/ 0 - 2 \
Expand Down
2 changes: 1 addition & 1 deletion model-optimizer/extensions/front/tf/fifo_replacer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def pattern(**kwargs):

@staticmethod
def replace_sub_graph(graph: Graph, match: dict, **kwargs):
"""
r"""
Usually graph looks like:
main_graph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class FloorDivDecomposition(FrontReplacementPattern):
"""
r"""
BEFORE: AFTER:
input_0 input_1 input_0 input_1
\ / \ /
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class IdentityN_to_Identity(FrontReplacementPattern):
"""
r"""
Replaces IdentityN op with several Identity ops.
Example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def pattern(self):
@staticmethod
def replace_pattern(graph: Graph, match: dict):
time_len = match['concatenated_hidden_states'].shape[0]
"""
r"""
Working with concatenated_cell_states_data part first, because IE TensorIterator primitive doesn't have
concatenated cell states output and if we can not collapse it, then we does not support this type of BlockLSTM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def insert_permute_inputs_before_dynamic_weights_subgraph(dynamic_subgraphs: Set

@staticmethod
def walk_up_from_in_ports_to_out_ports(in_ports: Set[Port], out_ports: Set[Port], port_condition=None):
""""
r""""
Returns all intermediate ports and nodes of such a sub-graph:
out_ports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class RemoveUselessConcatSplitPattern(MiddleReplacementPattern):
"""
r"""
Remove useless construction with concat and split like follows:
/ / | \ \
br1 br2 .. br(n-1)br(n)
Expand Down
2 changes: 1 addition & 1 deletion model-optimizer/extensions/middle/RemoveUselessCrops.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class RemoveUselessCropsPattern(MiddleReplacementPattern):
"""
r"""
Remove useless construction with crops and concat like follows:
in_node
/ / | \ \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


class ReplaceSpliceNodePattern(MiddleReplacementPattern):
"""
r"""
This pass decomposes Splice layer to the sequence Slice Concat and Memory layers
For example:
Let's suppose we have next graph:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


class StridedSliceNormalizer(MiddleReplacementPattern):
"""
r"""
StridedSlice is not normal if it cannot be permuted by ApplyPermutations. This normalizer
inserts blank colons ':' in slice expression so that it can be correctly permuted
from NHWC to NCHW layout. It changes masks and inserts blank begin, end and strides values.
Expand Down
2 changes: 1 addition & 1 deletion model-optimizer/extensions/middle/TensorIteratorInput.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def replace_pattern(graph: Graph, match: dict):


class SmartMatcherInputSlicingWithGather(MiddleReplacementPattern):
"""
r"""
The transformation matches a sub-graph where input tensor is consequently sliced along some axis
for each time step (or index) inside TensorFlow 1.x while_loop operation.
In the original graph StridedSlice with non-constant begin and end attributes performs this slicing.
Expand Down
2 changes: 1 addition & 1 deletion model-optimizer/mo/front/tf/graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def add_convolution_to_swap_xy_coordinates(graph: Graph, input_node: Node, coord


def add_fake_background_loc(graph: Graph, input_node: Node):
"""
r"""
DetectionOutput layer expects that box coordinates contains coordinates of boxes for the "background" class also,
but in the TensorFlow\* Object Detection API the tensor contains information about real object classes only.
The function copies a slice of the output data of the node 'input_node' and then concats it to the beginning of the
Expand Down
4 changes: 2 additions & 2 deletions model-optimizer/mo/graph/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ def check_and_remove_edge():
return {}, None

if self.destinations and len(self.destinations) > 1:
raise Error("set_destination applicable only for connections that has exactly one destination or \
when there is no destinations")
raise Error("set_destination applicable only for connections that has exactly one destination or "
"when there is no destinations")

if port.type == 'out':
raise Error("Wrong port type in set_destination method. Should be 'in' but given 'out'")
Expand Down

0 comments on commit d782c76

Please sign in to comment.