Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
9f7c9875
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9f7c9875
编写于
10月 25, 2017
作者:
C
chengduoZH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix doc
上级
3f8a7b55
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
30 addition
and
11 deletion
+30
-11
paddle/operators/conv3d_op.cc
paddle/operators/conv3d_op.cc
+30
-9
paddle/operators/pool_op.cc
paddle/operators/pool_op.cc
+0
-2
未找到文件。
paddle/operators/conv3d_op.cc
浏览文件 @
9f7c9875
...
@@ -38,11 +38,12 @@ void Conv3DOp::InferShape(framework::InferShapeContext* ctx) const {
...
@@ -38,11 +38,12 @@ void Conv3DOp::InferShape(framework::InferShapeContext* ctx) const {
int
input_channels
=
in_dims
[
1
];
int
input_channels
=
in_dims
[
1
];
int
output_channels
=
filter_dims
[
0
];
int
output_channels
=
filter_dims
[
0
];
PADDLE_ENFORCE_EQ
(
in_dims
.
size
(),
5
,
"Conv3DOp input should be 5-D."
);
PADDLE_ENFORCE_EQ
(
in_dims
.
size
(),
5
,
"Conv3DOp input should be 5-D tensor."
);
PADDLE_ENFORCE_EQ
(
filter_dims
.
size
(),
5
,
"Conv3DOp filter should be 5-D."
);
PADDLE_ENFORCE_EQ
(
filter_dims
.
size
(),
5
,
"Conv3DOp filter should be 5-D tensor."
);
PADDLE_ENFORCE_EQ
(
input_channels
,
filter_dims
[
1
]
*
groups
,
PADDLE_ENFORCE_EQ
(
input_channels
,
filter_dims
[
1
]
*
groups
,
"The number of input channels should be equal to filter "
"The number of input channels should be equal to filter "
"
channels * groups
."
);
"
(channels * groups)
."
);
PADDLE_ENFORCE_EQ
(
PADDLE_ENFORCE_EQ
(
output_channels
%
groups
,
0
,
output_channels
%
groups
,
0
,
"The number of output channels should be divided by groups."
);
"The number of output channels should be divided by groups."
);
...
@@ -71,27 +72,31 @@ Conv3DOpMaker::Conv3DOpMaker(framework::OpProto* proto,
...
@@ -71,27 +72,31 @@ Conv3DOpMaker::Conv3DOpMaker(framework::OpProto* proto,
:
OpProtoAndCheckerMaker
(
proto
,
op_checker
)
{
:
OpProtoAndCheckerMaker
(
proto
,
op_checker
)
{
AddInput
(
AddInput
(
"Input"
,
"Input"
,
"
T
he input tensor of convolution operator. "
"
(Tensor), t
he input tensor of convolution operator. "
"The format of input tensor is NCDHW. Where N is batch size, C is the "
"The format of input tensor is NCDHW. Where N is batch size, C is the "
"number of channels, D, H and W is the depth, height and width of "
"number of channels, D, H and W is the depth, height and width of "
"image."
);
"image."
);
AddInput
(
"Filter"
,
AddInput
(
"Filter"
,
"
T
he filter tensor of convolution operator."
"
(Tensor), t
he filter tensor of convolution operator."
"The format of the filter tensor is MCDHW, where M is the number of "
"The format of the filter tensor is MCDHW, where M is the number of "
"output image channels, C is the number of input image channels, "
"output image channels, C is the number of input image channels, "
"D, H and W is depth, height and width of filter. "
"D, H and W is depth, height and width of filter. "
"If the groups attribute is greater than 1, C equal the number of "
"If the groups attribute is greater than 1, C equal the number of "
"input image channels divided by the groups."
);
"input image channels divided by the groups."
);
AddOutput
(
"Output"
,
AddOutput
(
"Output"
,
"
T
he output tensor of convolution operator."
"
(Tensor), t
he output tensor of convolution operator."
"The format of output tensor is also NCDHW."
);
"The format of output tensor is also NCDHW."
);
AddAttr
<
std
::
vector
<
int
>>
(
"strides"
,
"strides of convolution operator."
)
AddAttr
<
std
::
vector
<
int
>>
(
"strides"
,
"(vector, default {0,0,0}), the strides of convolution operator."
)
.
SetDefault
({
1
,
1
,
1
});
.
SetDefault
({
1
,
1
,
1
});
AddAttr
<
std
::
vector
<
int
>>
(
"paddings"
,
"The paddings of convolution operator."
)
AddAttr
<
std
::
vector
<
int
>>
(
"paddings"
,
"(vector, default {0,0,0}), the paddings of convolution operator."
)
.
SetDefault
({
0
,
0
,
0
});
.
SetDefault
({
0
,
0
,
0
});
AddAttr
<
int
>
(
AddAttr
<
int
>
(
"groups"
,
"groups"
,
"
T
he group size of convolution operator. "
"
(int, default 1) t
he group size of convolution operator. "
"Refer to grouped convolution in Alex Krizhevsky's paper: "
"Refer to grouped convolution in Alex Krizhevsky's paper: "
"when group=2, the first half of the filters are only connected to the "
"when group=2, the first half of the filters are only connected to the "
"first half of the input channels, and the second half only connected "
"first half of the input channels, and the second half only connected "
...
@@ -101,6 +106,22 @@ Conv3DOpMaker::Conv3DOpMaker(framework::OpProto* proto,
...
@@ -101,6 +106,22 @@ Conv3DOpMaker::Conv3DOpMaker(framework::OpProto* proto,
The convolution operation calculates the output based on the input, filter
The convolution operation calculates the output based on the input, filter
and strides, paddings, groups parameters. The size of each dimension of the
and strides, paddings, groups parameters. The size of each dimension of the
parameters is checked in the infer-shape.
parameters is checked in the infer-shape.
Input(Input, Filter) and output(Output) are in NCDHW format. Where N is batch
size, C is the number of channels, D, H and W is the depth, height and
width of feature. Parameters(ksize, strides, paddings) are three elements.
These three elements represent depth, height and width, respectively.
The input(X) size and output(Out) size may be different.
Example:
Input:
Input shape: (N, C_in, D_in, H_in, W_in)
Filter shape: (C_out, C_in, D_f, H_f, W_f)
Output:
Output shape: (N, C_out, D_out, H_out, W_out)
where
D_out = (D_in - filter_size[0] + 2 * paddings[0]) / strides[0] + 1;
H_out = (H_in - filter_size[1] + 2 * paddings[1]) / strides[1] + 1;
W_out = (W_in - filter_size[2] + 2 * paddings[2]) / strides[2] + 1;
)DOC"
);
)DOC"
);
}
}
...
...
paddle/operators/pool_op.cc
浏览文件 @
9f7c9875
...
@@ -123,7 +123,6 @@ Example:
...
@@ -123,7 +123,6 @@ Example:
X shape: (N, C, H_in, W_in)
X shape: (N, C, H_in, W_in)
Output:
Output:
Out shape: (N, C, H_out, W_out)
Out shape: (N, C, H_out, W_out)
Mask shape: (N, C, H_out, W_out)
where
where
H_out = (H_in - ksize[0] + 2 * paddings[0]) / strides[0] + 1;
H_out = (H_in - ksize[0] + 2 * paddings[0]) / strides[0] + 1;
W_out = (W_in - ksize[1] + 2 * paddings[1]) / strides[1] + 1;
W_out = (W_in - ksize[1] + 2 * paddings[1]) / strides[1] + 1;
...
@@ -190,7 +189,6 @@ Example:
...
@@ -190,7 +189,6 @@ Example:
X shape: (N, C, D_in, H_in, W_in)
X shape: (N, C, D_in, H_in, W_in)
Output:
Output:
Out shape: (N, C, D_out, H_out, W_out)
Out shape: (N, C, D_out, H_out, W_out)
Mask shape: (N, C, D_out, H_out, W_out)
where
where
D_out = (D_in - ksize[0] + 2 * paddings[0]) / strides[0] + 1;
D_out = (D_in - ksize[0] + 2 * paddings[0]) / strides[0] + 1;
H_out = (H_in - ksize[1] + 2 * paddings[1]) / strides[1] + 1;
H_out = (H_in - ksize[1] + 2 * paddings[1]) / strides[1] + 1;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录