Skip to content

Commit 6e5c1d3

Browse files
committed
handling the case wjem stop is max int64 value in the dynamic dimension
1 parent a9467cd commit 6e5c1d3

File tree

1 file changed

+5
-3
lines changed
  • py/torch_tensorrt/dynamo/conversion/impl/slice

1 file changed

+5
-3
lines changed

py/torch_tensorrt/dynamo/conversion/impl/slice/ops.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from typing import Optional, Sequence
33

44
import numpy as np
5+
import sys
56
import tensorrt as trt
67
from torch.fx.node import Target
78
from torch_tensorrt.dynamo._SourceIR import SourceIR
@@ -65,15 +66,16 @@ def slice_op( # TODO: This should be slice not whatever is in base
6566
start_slice[dim] = start
6667
else:
6768
# the start and stop or None is dynamic along dim
68-
if start < 0 or stop < 0 or stop_dynamic_None:
69+
if start < 0 or stop < 0 or stop_dynamic_None or stop == sys.maxsize:
6970
# special assignments for dynamic cases
7071
if start < 0:
7172
start_slice = input.shape
7273
start_slice[dim] = -1 * start
7374
if stop < 0 or stop_dynamic_None:
7475
stop_slice = [0] * len(input.shape)
7576
stop_slice[dim] = -1 * stop
76-
77+
if(stop == sys.maxsize):
78+
stop_slice = [0] * len(input.shape)
7779
start_slice_tensor = cat(
7880
ctx,
7981
target,
@@ -115,7 +117,7 @@ def slice_op( # TODO: This should be slice not whatever is in base
115117
shape,
116118
start_slice_tensor,
117119
)
118-
if (stop < 0) or stop_dynamic_None:
120+
if ((stop < 0) or stop_dynamic_None or stop == sys.maxsize):
119121
shape = get_shape_with_dynamic_shape(
120122
ctx, target, source_ir, name, output_shape, input
121123
)

0 commit comments

Comments
 (0)