Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
a5eb1d8f
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a5eb1d8f
编写于
7月 11, 2017
作者:
Q
qijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix build error
上级
d607f0b7
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
9 addition
and
16 deletion
+9
-16
paddle/framework/CMakeLists.txt
paddle/framework/CMakeLists.txt
+1
-1
paddle/framework/ddim.cc
paddle/framework/ddim.cc
+3
-3
paddle/framework/ddim.h
paddle/framework/ddim.h
+1
-1
paddle/framework/tensor.h
paddle/framework/tensor.h
+4
-11
未找到文件。
paddle/framework/CMakeLists.txt
浏览文件 @
a5eb1d8f
# ddim lib
# ddim lib
cc_library
(
ddim SRCS ddim.cc
)
cc_library
(
ddim SRCS ddim.cc
DEPS eigen3
)
cc_test
(
ddim_test SRCS ddim_test.cc DEPS ddim
)
cc_test
(
ddim_test SRCS ddim_test.cc DEPS ddim
)
nv_test
(
dim_test SRCS dim_test.cu DEPS ddim
)
nv_test
(
dim_test SRCS dim_test.cu DEPS ddim
)
cc_test
(
tensor_test SRCS tensor_test.cc DEPS ddim
)
cc_test
(
tensor_test SRCS tensor_test.cc DEPS ddim
)
...
...
paddle/framework/ddim.cc
浏览文件 @
a5eb1d8f
...
@@ -222,9 +222,9 @@ std::ostream& operator<<(std::ostream& os, const DDim& ddim) {
...
@@ -222,9 +222,9 @@ std::ostream& operator<<(std::ostream& os, const DDim& ddim) {
}
}
template
<
int
NDIMS
>
template
<
int
NDIMS
>
Eigen
::
DSizes
<
Eigen
::
DenseIndex
,
NDIMS
>
ToEigenDSizes
(
DDim
dims
)
const
{
Eigen
::
DSizes
<
Eigen
::
DenseIndex
,
NDIMS
>
ToEigenDSizes
(
const
DDim
&
dims
)
{
int
rank
=
paddle
::
framework
::
arity
(
dims
);
int
rank
=
arity
(
dims
);
PADDLE_ENFORCE
(
rank
==
NDIMS
,
"DDim and NDIMS must be same"
)
PADDLE_ENFORCE
(
rank
==
NDIMS
,
"DDim and NDIMS must be same"
)
;
Eigen
::
DSizes
<
Eigen
::
DenseIndex
,
NDIMS
>
dsizes
;
Eigen
::
DSizes
<
Eigen
::
DenseIndex
,
NDIMS
>
dsizes
;
for
(
int
d
=
0
;
d
<
rank
;
d
++
)
{
for
(
int
d
=
0
;
d
<
rank
;
d
++
)
{
dsizes
[
d
]
=
dims
[
d
];
dsizes
[
d
]
=
dims
[
d
];
...
...
paddle/framework/ddim.h
浏览文件 @
a5eb1d8f
...
@@ -93,7 +93,7 @@ int arity(const DDim& ddim);
...
@@ -93,7 +93,7 @@ int arity(const DDim& ddim);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
const
DDim
&
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
const
DDim
&
);
template
<
int
NDIMS
>
template
<
int
NDIMS
>
Eigen
::
DSizes
<
Eigen
::
DenseIndex
,
NDIMS
>
ToEigenDSizes
(
DDim
dims
)
const
;
Eigen
::
DSizes
<
Eigen
::
DenseIndex
,
NDIMS
>
ToEigenDSizes
(
const
DDim
&
dims
)
;
}
// namespace framework
}
// namespace framework
}
// namespace paddle
}
// namespace paddle
...
...
paddle/framework/tensor.h
浏览文件 @
a5eb1d8f
...
@@ -28,13 +28,6 @@ namespace framework {
...
@@ -28,13 +28,6 @@ namespace framework {
class
Tensor
{
class
Tensor
{
public:
public:
template
<
typename
T
>
const
T
*
data
()
const
{
PADDLE_ENFORCE
(
holder_
!=
nullptr
,
"Tensor::data must be called after Tensor::mutable_data."
);
return
static_cast
<
const
T
*>
(
holder_
->
Ptr
());
}
template
<
typename
T
>
template
<
typename
T
>
T
*
data
()
const
{
T
*
data
()
const
{
PADDLE_ENFORCE
(
holder_
!=
nullptr
,
PADDLE_ENFORCE
(
holder_
!=
nullptr
,
...
@@ -60,14 +53,14 @@ class Tensor {
...
@@ -60,14 +53,14 @@ class Tensor {
size_t
NumElements
()
const
{
return
product
(
dims_
);
}
size_t
NumElements
()
const
{
return
product
(
dims_
);
}
template
<
typename
T
,
size_t
NDIMS
>
template
<
typename
T
,
size_t
NDIMS
>
typename
TTypes
<
T
,
NDIMS
>::
Tensor
Tensor
::
shaped
(
DDim
new_dims
)
{
typename
TTypes
<
T
,
NDIMS
>::
Tensor
shaped
(
DDim
new_dims
)
{
Eigen
::
array
<
Eigen
::
DenseIndex
,
NDIMS
>
dims
=
Eigen
::
array
<
Eigen
::
DenseIndex
,
NDIMS
>
dims
=
paddle
::
framework
::
ToEigenDSizes
(
new_dims
);
paddle
::
framework
::
ToEigenDSizes
<
NDIMS
>
(
new_dims
);
return
typename
TTypes
<
T
,
NDIMS
>::
Tensor
(
data
<
T
>
(),
dims
);
return
typename
TTypes
<
T
,
NDIMS
>::
Tensor
(
data
<
T
>
(),
dims
);
}
}
template
<
typename
T
,
size_t
NDIMS
>
template
<
typename
T
,
size_t
NDIMS
>
typename
TTypes
<
T
,
NDIMS
>::
Tensor
Tensor
::
tensor
()
{
typename
TTypes
<
T
,
NDIMS
>::
Tensor
tensor
()
{
return
typename
TTypes
<
T
,
NDIMS
>::
Tensor
(
return
typename
TTypes
<
T
,
NDIMS
>::
Tensor
(
data
<
T
>
(),
paddle
::
framework
::
ToEigenDSizes
<
NDIMS
>
(
dims_
));
data
<
T
>
(),
paddle
::
framework
::
ToEigenDSizes
<
NDIMS
>
(
dims_
));
}
}
...
@@ -92,7 +85,7 @@ class Tensor {
...
@@ -92,7 +85,7 @@ class Tensor {
// const versions of all the methods above.
// const versions of all the methods above.
template
<
typename
T
,
size_t
NDIMS
>
template
<
typename
T
,
size_t
NDIMS
>
typename
TTypes
<
T
,
NDIMS
>::
ConstantTensor
Tensor
::
tensor
()
const
{
typename
TTypes
<
T
,
NDIMS
>::
ConstantTensor
tensor
()
const
{
return
typename
TTypes
<
T
,
NDIMS
>::
Tensor
(
return
typename
TTypes
<
T
,
NDIMS
>::
Tensor
(
data
<
T
>
(),
paddle
::
framework
::
ToEigenDSizes
<
NDIMS
>
(
dims_
));
data
<
T
>
(),
paddle
::
framework
::
ToEigenDSizes
<
NDIMS
>
(
dims_
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录