-
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
【BUPT】【Paddle TensorRT No.38】Add pd_op.gather converter #69714
base: develop
Are you sure you want to change the base?
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -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 |
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.
参考paddle/fluid/inference/tensorrt/convert/gather_op.cc
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.
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 |
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.
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, |
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还有pir::value的情况,用np.array组网,放到feed_list中
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 |
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.
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"]} |
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为int输入的情况
PR Category
User Experience
PR Types
New features
Description
新增pd_op.gather