Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
e6095bc2
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
e6095bc2
编写于
2月 04, 2021
作者:
S
Shang Zhizhou
提交者:
GitHub
2月 04, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix split trt plugin initialize (#30875)
* fix split trt plugin initialize * update
上级
6e3856d3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
1 deletion
+20
-1
paddle/fluid/inference/tensorrt/plugin/split_op_plugin.cu
paddle/fluid/inference/tensorrt/plugin/split_op_plugin.cu
+13
-0
paddle/fluid/inference/tensorrt/plugin/split_op_plugin.h
paddle/fluid/inference/tensorrt/plugin/split_op_plugin.h
+7
-1
未找到文件。
paddle/fluid/inference/tensorrt/plugin/split_op_plugin.cu
浏览文件 @
e6095bc2
...
...
@@ -62,6 +62,16 @@ nvinfer1::Dims SplitPlugin::getOutputDimensions(
return
output_dims
;
}
void
SplitPlugin
::
shareData
(
const
SplitPlugin
*
another
)
{
outer_rows_
=
another
->
outer_rows_
;
inner_cols_
=
another
->
inner_cols_
;
same_shape_
=
another
->
same_shape_
;
axis_shape_
=
another
->
axis_shape_
;
d_segment_offsets_
=
another
->
d_segment_offsets_
;
segment_offsets_
=
another
->
segment_offsets_
;
d_output_ptrs_
.
resize
(
another
->
d_output_ptrs_
.
size
(),
nullptr
);
}
int
SplitPlugin
::
initialize
()
{
PADDLE_ENFORCE_LE
(
axis_
,
nvinfer1
::
Dims
::
MAX_DIMS
,
platform
::
errors
::
InvalidArgument
(
...
...
@@ -93,6 +103,9 @@ int SplitPlugin::initialize() {
return
0
;
}
// nothing to release according to initialize
void
SplitPlugin
::
terminate
()
{}
// The following part of the code refers to onnx-tensorrt
// https://github.com/onnx/onnx-tensorrt/blob/master/Split.cu
template
<
typename
T
>
...
...
paddle/fluid/inference/tensorrt/plugin/split_op_plugin.h
浏览文件 @
e6095bc2
...
...
@@ -40,7 +40,9 @@ class SplitPlugin : public PluginTensorRT {
}
SplitPlugin
*
clone
()
const
override
{
return
new
SplitPlugin
(
axis_
,
output_length_
,
with_fp16_
);
auto
*
ptr
=
new
SplitPlugin
(
axis_
,
output_length_
,
with_fp16_
);
ptr
->
shareData
(
this
);
return
ptr
;
}
const
char
*
getPluginType
()
const
override
{
return
"split_plugin"
;
}
...
...
@@ -50,6 +52,7 @@ class SplitPlugin : public PluginTensorRT {
int
num_inputs
)
override
;
int
initialize
()
override
;
void
terminate
()
override
;
int
enqueue
(
int
batchSize
,
const
void
*
const
*
inputs
,
void
**
outputs
,
void
*
workspace
,
cudaStream_t
stream
)
override
;
...
...
@@ -75,6 +78,9 @@ class SplitPlugin : public PluginTensorRT {
std
::
vector
<
int
>
segment_offsets_
;
thrust
::
device_vector
<
int
>
d_segment_offsets_
;
thrust
::
device_vector
<
float
*>
d_output_ptrs_
;
private:
void
shareData
(
const
SplitPlugin
*
another
);
};
#if IS_TRT_VERSION_GE(6000)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录