Skip to content

Commit

Permalink
corrected a typo normalize_slice_indices comment
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-esir committed Jul 31, 2020
1 parent a3aa529 commit 831e2db
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions model-optimizer/mo/ops/slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ def get_shape_after_slice(input_shape: int, slice_idx: int):
return output_shape


def normalize_slice_indices(size: int, start: int, end: int):
# converts slice indices to format in which size of slice can be calculated
start = convert_negative_indices(size, start)
end = convert_negative_indices(size, end)
start = clip_indices(size, start)
end = clip_indices(size, end)
return start, end


def convert_negative_indices(size: int, val: int):
"""
Converts negative indices of a tensors: e.g. if val == -1 then convert it to size
Expand All @@ -202,12 +211,3 @@ def clip_indices(size: int, val: int):
else:
return val


def normalize_slice_indices(size: int, start: int, end: int):
# convert slice_indices to format in which size of slice can calculated
start = convert_negative_indices(size, start)
end = convert_negative_indices(size, end)
start = clip_indices(size, start)
end = clip_indices(size, end)
return start, end

0 comments on commit 831e2db

Please sign in to comment.