From: Maxim Vafin Date: Tue, 9 Jun 2020 14:50:38 +0000 (+0300) Subject: Fix onnx slice by clipping `ends` to int32 domain (#603) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=074266bf73ed541c7bfd471229f73cc05411ebed;p=platform%2Fupstream%2Fdldt.git Fix onnx slice by clipping `ends` to int32 domain (#603) --- diff --git a/model-optimizer/extensions/middle/SliceConverter.py b/model-optimizer/extensions/middle/SliceConverter.py index ba6e7e1..73d1d5a 100644 --- a/model-optimizer/extensions/middle/SliceConverter.py +++ b/model-optimizer/extensions/middle/SliceConverter.py @@ -71,7 +71,7 @@ class ConvertSlice(MiddleReplacementPattern): # in ONNX the value for 'ends' is usually -1 which is translated to maximum possible value of int64. This # value must be converted to maximum of int32 because such big values do not fit into the int32 which is # supported by the StridedSlice layer - ends = int64_array([np.iinfo(np.int32).max if item > np.iinfo(np.int32).max else item for item in ends]) + ends = np.clip(ends, np.iinfo(np.int32).min, np.iinfo(np.int32).max) if node.is_in_port_connected(3): axes = node.in_port(3).data.get_value() if axes is None: