Skip to content
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

【BUPT】【Paddle TensorRT No.38】Add pd_op.gather converter #69714

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

ZHOU05030
Copy link
Contributor

PR Category

User Experience

PR Types

New features

Description

新增pd_op.gather

Copy link

paddle-bot bot commented Nov 26, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Nov 26, 2024
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Nov 27, 2024
@@ -70,6 +70,15 @@ def reshape_converter(network, paddle_op, inputs):
return shuffle_layer.get_output(0)


@converter_registry.register("pd_op.gather", trt_version="8.x")
def gather_converter(network, paddle_op, inputs):
input_tensor, index_tensor, *_ = inputs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参考paddle/fluid/inference/tensorrt/convert/gather_op.cc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index和axis还有pir::value的情况,这里没有实现,另外,axis是输入,而不是属性

@@ -70,6 +70,15 @@ def reshape_converter(network, paddle_op, inputs):
return shuffle_layer.get_output(0)


@converter_registry.register("pd_op.gather", trt_version="8.x")
def gather_converter(network, paddle_op, inputs):
input_tensor, index_tensor, *_ = inputs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index和axis还有pir::value的情况,这里没有实现,另外,axis是输入,而不是属性

self.api_args = {
"x": np.random.random([3, 4, 10]).astype("float32"),
"index": np.array([0, 2]).astype("int64"),
"axis": 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

axis还有pir::value的情况,用np.array组网,放到feed_list中

Copy link

paddle-ci-bot bot commented Dec 12, 2024

Sorry to inform you that 46edbd0's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@@ -70,6 +70,17 @@ def reshape_converter(network, paddle_op, inputs):
return shuffle_layer.get_output(0)


@converter_registry.register("pd_op.gather", trt_version="8.x")
def gather_converter(network, paddle_op, inputs):
input_tensor, index_tensor, axis = inputs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if xxx.get_defining_op():
拿到value
else:
axis=inputs[2]

"index": np.array([0, 2]).astype("int64"),
"axis": np.array([1]).astype("int32"),
}
self.program_config = {"feed_list": ["x", "index", "axis"]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加一个axis为int输入的情况

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants