Skip to content

Conversation

@ming1753
Copy link
Contributor

PR types

Others

PR changes

Others

Description

Pcard-71501

借助Loop实现了flip算子到TRT的映射,并添加相应单测。
整体的逻辑参考paddle2onnx中的flip -> split + concat的思路,Loop中的IIteratorLayer可以通过指定reverse参数实现split + reverse的效果,ILoopOutputLayer可以实现concat的效果。

@@ -0,0 +1,83 @@
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

改成2023

@@ -0,0 +1,144 @@
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

改2023

return false;
}
#if !IS_TRT_VERSION_GE(7220)
VLOG(3) << "flip is not supported when TensorRT blow 7.2.2";
Copy link
Contributor

Choose a reason for hiding this comment

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

bellow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已全部修正


// Get Attrs
std::vector<int> axis =
PADDLE_GET_CONST(std::vector<int>, op_desc.GetAttr("axis"));
Copy link
Contributor

Choose a reason for hiding this comment

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

原生op定义中,axis 可以是 int也可以是list(vector),这里看起来只考虑了list 的情况?

Copy link
Contributor Author

@ming1753 ming1753 Jul 27, 2023

Choose a reason for hiding this comment

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

原生op通过在python源代码中转成list支持int,convert时候只能拿到vector

}

if (op_type == "flip") {
if (!desc.HasAttr("axis")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

这个是一个必要属性,组网的时候如果没有这个属性会报错,可以不加这个回退条件

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已删除

Copy link
Contributor

@Wangzheee Wangzheee left a comment

Choose a reason for hiding this comment

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

LGTM

program_config.ops[i].attrs for i in range(len(program_config.ops))
]
self.trt_param.max_batch_size = 9
self.trt_param.workspace_size = 1073741824
Copy link
Contributor

Choose a reason for hiding this comment

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

这个没必要开这么大吧

self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True
), 1e-3
Copy link
Contributor

Choose a reason for hiding this comment

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

这个阈值用默认的,没必要放大

@Wangzheee Wangzheee merged commit d608170 into PaddlePaddle:develop Jul 27, 2023
wz1qqx pushed a commit to wz1qqx/Paddle that referenced this pull request Jul 31, 2023
Wang-1F pushed a commit to Wang-1F/Paddle that referenced this pull request Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants