You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adapt python op converters covered in paddle-3-beta2 for TRT 10 (#69510)
* Adapt `paddle.tensorrt.converter` to TRT 10
This commit includes basic migration to TRT 10 API, and also enable
those converter who are tested with existing unittest to TRT10
For those 2 converter which is NOT included in this commit:
- python/paddle/tensorrt/impls/attribute.py
- python/paddle/tensorrt/impls/common.py
Need to fix these 2 behavior issues in later commit.
* Adapt "pd_op.shape" TRT op converter to TRT10
Although `IShapeLayer` supports shape in int64 since TRT10, some paddle
native op kernel only implements their input shape tensor (if exists)
in int32. Hence, there is a workaround in `trt_shape` to cast the
result of TRT `IShapeLayer` back to int32 to be more compatible with
other paddle op. (see python/paddle/tensorrt/converter_utils.py)
Please remove the workaround when all paddle op supports their shape in
int64.
Also, since `IShapeLayer` return shape in int64 in TRT10, the
"pd_op.shape64" will be seamlessly supported in TRT10 w/o any extra
workaround.
* Fix converter error in TRT10 for interpolation ops
Error detail:
{
(%1) = "pd_op.bilinear_interp" [id:28] (%2, %3, <<NULL VALUE>>, <<NULL VALUE>>) {__l_trt__:true,align_corners:false,align_mode:(Int32)0,data_format:"NCHW",interp_method:"bilinear",out_d:(Int32)-1,out_h:(Int32)12,out_w:(Int32)12,scale:[],stop_gradient:[true]} : (builtin.tensor<-1x3x6x10xf32>, builtin.tensor<2xi32>, <<NULL TYPE>>, <<NULL TYPE>>) -> builtin.tensor<-1x3x12x12xf32>
() = "cf.yield" [id:36] (%1) {} : (builtin.tensor<-1x3x12x12xf32>) ->
}
[TRT] [E] ITensor::getDimensions: Error Code 4: API Usage Error ((Unnamed Layer* 6) [Concatenation]: concat input tensors 0 and 2 have incompatible types Int64 and Int32)
[TRT] [E] IBuilder::buildSerializedNetwork: Error Code 4: API Usage Error ((Unnamed Layer* 6) [Concatenation]: concat input tensors 0 and 2 have incompatible types Int64 and Int32)
The error happened in "python/paddle/tensorrt/impls/common.py" because
IConcatenationLayer requires all input to be same dtype.
The (shape)tensor passed from paddle op will be int32, while the TRT
IShapeLayer supports int64 shape; thereby, cannot be concatenated with
each other.
Here, we call `trt_shape` to get shape tensor whose dtype aligned with
the dtype from paddle op.
* Add int64 in TRT->paddle dtype mapping function
* Fix "test_converter_math" by enable op for TRT 10
test_converter_math can pass unittest with environment with TRT 10.6
* Adapt 3 manipulation converters to TRT 10
- "pd_op.expand"
- "pd_op.expand_as"
- "pd_op.slice"
0 commit comments