Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
ab91232c
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看板
提交
ab91232c
编写于
6月 27, 2017
作者:
Q
qijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add cmake external project for eigen
上级
4db23bba
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
65 addition
and
0 deletion
+65
-0
CMakeLists.txt
CMakeLists.txt
+1
-0
cmake/external/eigen.cmake
cmake/external/eigen.cmake
+20
-0
paddle/framework/ddim_test.cc
paddle/framework/ddim_test.cc
+44
-0
未找到文件。
CMakeLists.txt
浏览文件 @
ab91232c
...
...
@@ -92,6 +92,7 @@ include(external/openblas) # download, build, install openblas
include
(
external/swig
)
# download, build, install swig
include
(
external/warpctc
)
# download, build, install warpctc
include
(
external/any
)
# download libn::any
include
(
external/eigen
)
# download eigen3
include
(
generic
)
# simplify cmake module
include
(
package
)
# set paddle packages
...
...
cmake/external/eigen.cmake
0 → 100644
浏览文件 @
ab91232c
INCLUDE
(
ExternalProject
)
SET
(
EIGEN_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/eigen3
)
INCLUDE_DIRECTORIES
(
${
EIGEN_SOURCE_DIR
}
/src/
)
ExternalProject_Add
(
eigen3
${
EXTERNAL_PROJECT_LOG_ARGS
}
URL
"https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz"
URL_MD5
"4645c66075982da6fa0bcf6b20f3e8f7"
PREFIX
${
EIGEN_SOURCE_DIR
}
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
TEST_COMMAND
""
)
LIST
(
APPEND external_project_dependencies eigen3
)
\ No newline at end of file
paddle/framework/ddim_test.cc
浏览文件 @
ab91232c
#include <sstream>
#include <vector>
#include "eigen3/Eigen/Core"
#include "eigen3/Eigen/Dense"
#include "eigen3/unsupported/Eigen/CXX11/Tensor"
#include "gtest/gtest.h"
#include "paddle/framework/ddim.h"
...
...
@@ -61,3 +64,44 @@ TEST(DDim, Print) {
ss
<<
ddim
;
EXPECT_EQ
(
"2, 3, 4"
,
ss
.
str
());
}
template
<
typename
T
>
using
Vec
=
Eigen
::
TensorMap
<
Eigen
::
Tensor
<
T
,
1
,
Eigen
::
RowMajor
,
Eigen
::
DenseIndex
>
,
Eigen
::
Aligned
>
;
template
<
typename
T
>
using
Matrix
=
Eigen
::
TensorMap
<
Eigen
::
Tensor
<
T
,
2
,
Eigen
::
RowMajor
,
Eigen
::
DenseIndex
>
,
Eigen
::
Aligned
>
;
template
<
typename
T
>
void
print
(
T
*
input
,
int
size
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
std
::
cout
<<
input
[
i
]
<<
" "
;
}
std
::
cout
<<
std
::
endl
;
}
TEST
(
Eigen
,
start
)
{
int
size
=
4
;
float
*
t_a
=
(
float
*
)
malloc
(
size
*
sizeof
(
float
));
float
*
t_b
=
(
float
*
)
malloc
(
size
*
sizeof
(
float
));
float
*
t_c
=
(
float
*
)
malloc
(
size
*
sizeof
(
float
));
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
t_a
[
i
]
=
i
;
t_b
[
i
]
=
i
;
}
Vec
<
float
>
a
(
t_a
,
size
);
Vec
<
float
>
b
(
t_b
,
size
);
Vec
<
float
>
c
(
t_c
,
size
);
Eigen
::
DefaultDevice
dd
;
c
.
device
(
dd
)
=
a
+
b
;
print
<
float
>
(
t_c
,
size
);
free
(
t_a
);
free
(
t_b
);
free
(
t_c
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录