-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Paddle TensorRT No.19] Add pd_op.cumsum converter #69330
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
Sorry to inform you that da03c88's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
dtype = input_tensor.dtype | ||
axis = paddle_op.operands()[1].source().get_defining_op().attrs()["value"] | ||
input_shape = input_tensor.shape | ||
rank = len(input_shape) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在支持rank=0了,和旧ir的converter保持对齐吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在rank=0的情况似乎通过zero_dims_to_one_dims自动转为rank = 1了
对
发自我的iPhone
…------------------ Original ------------------
From: Hanyonggong ***@***.***>
Date: Thu,Dec 26,2024 2:51 PM
To: PaddlePaddle/Paddle ***@***.***>
Cc: lizexu123 ***@***.***>, Comment ***@***.***>
Subject: Re: [PaddlePaddle/Paddle] [Paddle TensorRT No.19] Add pd_op.cumsumconverter (PR #69330)
@Hanyonggong commented on this pull request.
In python/paddle/tensorrt/impls/math.py:
> @@ -227,6 +228,96 @@ def all_converter(network, paddle_op, inputs): ) ***@***.***_registry.register("pd_op.cumsum", trt_version="8.x") +def cumsum_converter(network, paddle_op, inputs): + input_tensor = inputs[0] + dtype = input_tensor.dtype + axis = paddle_op.operands()[1].source().get_defining_op().attrs()["value"] + input_shape = input_tensor.shape + rank = len(input_shape)
现在rank=0的情况似乎通过zero_dims_to_one_dims自动转为rank = 1了
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
那应该就不用加rank =0 的情况了吧 |
python/paddle/tensorrt/impls/math.py
Outdated
# Obtain the number of cycles | ||
if input_shape[axis] > 0: | ||
axis_tensor = np.array(input_shape[axis], dtype=np.int32) | ||
trip_limit = network.add_constant((), axis_tensor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add_1d_constant_layer(scalar也要区分是否为标量),
python/paddle/tensorrt/impls/math.py
Outdated
axis_tensor = np.array(input_shape[axis], dtype=np.int32) | ||
trip_limit = network.add_constant((), axis_tensor) | ||
else: | ||
dynamic_shape = network.add_shape(input_tensor).get_output(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trt_reshape和get_shape_tensor_element复用
# Obtain the slice shape | ||
shape_list = [] | ||
for i in range(rank): | ||
if i == axis: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你这块代码和旧ir的差距较大,我建议你也写一个getAxisLength函数,这边怎么输入维度<0,又要reshape维度
start = [0] * rank | ||
size = [1] * rank | ||
stride = [1] * rank | ||
input_sliced = network.add_slice(input_tensor, start, size, stride) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果axis=0,sizes_tensor为add_1d_constant_layer(network,1),否则get_axis_length,这段代码在哪,strides_tensor呢
PR Category
Inference
PR Types
New features
Description
card-71500
添加了pd_op.cumsum Marker 和Converter