Getting weird internel error

I’m getting an error when running a code and this is the error:
[TRT] [E] 4: func:2198:SLICE:GPU: out of bounds slice, input dimensions = [1], start = [1], size = [1], stride = [1].

I understand what is the error, the error is in ISlice Layer I guess it means the input dimension is [1] and we are passing start=[1], size=[1] and stride=[1] this will not work because when we start from [1] and do stride [1] it will get out of bound because the size is also [1].

is this the error and did I explain the motive of this error which is right? could anyone have a solution for this because it is occurring because my data is one-dimensional?


Yes, you are correct. The error message is telling you that you are trying to slice a 1D tensor with start index 1, size 1, and stride 1. This is not possible because the slice will be out of bounds.

The valid index for a one-dimensional tensor with a size of 1 is 0. You should make sure that your slicing parameters are within the valid range of the input tensor. If you’re working with a one-dimensional tensor of size 1, you should only use a start index of 0 and a size of 1 to access the single element in the tensor.

If this slicing operation is part of a larger network, please review and ensure that the slicing parameters are correctly calculated based on the actual dimensions of the input data to avoid out-of-bounds errors.

Thanks for your reply this makes the clarification now. I just need to know another thing, I need to know exactly on which function/line the error is occurring because I debugged the whole model architecture and tried to find where exactly the error occurs but couldn’t find that, this error: [TRT] [E] 4: func:2198:SLICE:GPU: occurs when I tried to build the engine: engine = builder.build_engine(network, config).

Please try finding the layer name where error is happening and use the debug level logging.

I tried debugging the whole model and all the layers used in the Model but the weird part is that the above error raises on this line: engine: engine = builder.build_engine(network, config) which means the error raises on the creation of the engine that’s the problem and that’s why I can’t figure out the solution for this.

please could you help me out in this, this would be a huge Help

Are you using the ONNX model?
If yes, please try trtexec --onnx=<path/to/model> --verbose

I’m directly using torch2trt, I’m not using onnx, there is an option of verbose log for ERROR in torch2trt but it doesn’t show any error related to the above I guess.

Please share with us the minimal issue repro scripts/model and steps for better help.

Thank you.