Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
4c86285a
P
Paddle
项目概览
机器未来
/
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看板
提交
4c86285a
编写于
11月 11, 2016
作者:
W
wangyang59
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modifed Paddle.swig to specially handle UnsupportError only
上级
b2075351
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
14 addition
and
17 deletion
+14
-17
paddle/api/Matrix.cpp
paddle/api/Matrix.cpp
+2
-1
paddle/api/Paddle.swig
paddle/api/Paddle.swig
+4
-11
paddle/api/PaddleAPI.h
paddle/api/PaddleAPI.h
+6
-3
paddle/api/Vector.cpp
paddle/api/Vector.cpp
+2
-2
未找到文件。
paddle/api/Matrix.cpp
浏览文件 @
4c86285a
...
@@ -53,7 +53,8 @@ Matrix* Matrix::createDense(const std::vector<float>& data, size_t height,
...
@@ -53,7 +53,8 @@ Matrix* Matrix::createDense(const std::vector<float>& data, size_t height,
}
}
Matrix
*
Matrix
::
createDenseFromNumpy
(
float
*
data
,
int
dim1
,
int
dim2
,
Matrix
*
Matrix
::
createDenseFromNumpy
(
float
*
data
,
int
dim1
,
int
dim2
,
bool
copy
,
bool
useGpu
)
{
bool
copy
,
bool
useGpu
)
throw
(
UnsupportError
)
{
if
(
useGpu
)
{
if
(
useGpu
)
{
/// Gpu mode only supports copy=True
/// Gpu mode only supports copy=True
if
(
!
copy
)
{
if
(
!
copy
)
{
...
...
paddle/api/Paddle.swig
浏览文件 @
4c86285a
...
@@ -6,17 +6,10 @@
...
@@ -6,17 +6,10 @@
%}
%}
%include "exception.i"
%include "exception.i"
%exception{
%typemap(throws) UnsupportError %{
try{
SWIG_exception(SWIG_RuntimeError, $1.what());
$action
}
catch(UnsupportError &ex ){
SWIG_exception(SWIG_RuntimeError, ex.what());
}
catch( ... ){
SWIG_fail;
SWIG_fail;
}
%}
}
%include "std_vector.i"
%include "std_vector.i"
%include "std_pair.i"
%include "std_pair.i"
...
...
paddle/api/PaddleAPI.h
浏览文件 @
4c86285a
...
@@ -139,7 +139,8 @@ public:
...
@@ -139,7 +139,8 @@ public:
static
Matrix
*
createDenseFromNumpy
(
float
*
data
,
int
dim1
,
int
dim2
,
static
Matrix
*
createDenseFromNumpy
(
float
*
data
,
int
dim1
,
int
dim2
,
bool
copy
=
true
,
bool
copy
=
true
,
bool
useGpu
=
isUsingGpu
());
bool
useGpu
=
isUsingGpu
())
throw
(
UnsupportError
);
/**
/**
* Create Cpu Dense Matrix from numpy matrix, dtype=float32
* Create Cpu Dense Matrix from numpy matrix, dtype=float32
...
@@ -248,7 +249,8 @@ public:
...
@@ -248,7 +249,8 @@ public:
bool
useGpu
=
isUsingGpu
());
bool
useGpu
=
isUsingGpu
());
static
Vector
*
createVectorFromNumpy
(
float
*
data
,
int
dim
,
bool
copy
=
true
,
static
Vector
*
createVectorFromNumpy
(
float
*
data
,
int
dim
,
bool
copy
=
true
,
bool
useGpu
=
isUsingGpu
());
bool
useGpu
=
isUsingGpu
())
throw
(
UnsupportError
);
/**
/**
* Create Cpu Vector from numpy array, which dtype=float32
* Create Cpu Vector from numpy array, which dtype=float32
*
*
...
@@ -311,7 +313,8 @@ public:
...
@@ -311,7 +313,8 @@ public:
bool
useGpu
=
isUsingGpu
());
bool
useGpu
=
isUsingGpu
());
static
IVector
*
createVectorFromNumpy
(
int
*
data
,
int
dim
,
bool
copy
=
true
,
static
IVector
*
createVectorFromNumpy
(
int
*
data
,
int
dim
,
bool
copy
=
true
,
bool
useGpu
=
isUsingGpu
());
bool
useGpu
=
isUsingGpu
())
throw
(
UnsupportError
);
/**
/**
* Create Cpu IVector from numpy array, which dtype=int32
* Create Cpu IVector from numpy array, which dtype=int32
...
...
paddle/api/Vector.cpp
浏览文件 @
4c86285a
...
@@ -40,7 +40,7 @@ IVector* IVector::create(const std::vector<int>& data, bool useGpu) {
...
@@ -40,7 +40,7 @@ IVector* IVector::create(const std::vector<int>& data, bool useGpu) {
}
}
IVector
*
IVector
::
createVectorFromNumpy
(
int
*
data
,
int
dim
,
bool
copy
,
IVector
*
IVector
::
createVectorFromNumpy
(
int
*
data
,
int
dim
,
bool
copy
,
bool
useGpu
)
{
bool
useGpu
)
throw
(
UnsupportError
)
{
if
(
useGpu
)
{
if
(
useGpu
)
{
/// if use gpu only copy=true is supported
/// if use gpu only copy=true is supported
if
(
!
copy
)
{
if
(
!
copy
)
{
...
@@ -202,7 +202,7 @@ Vector* Vector::createByPaddleVectorPtr(void* ptr) {
...
@@ -202,7 +202,7 @@ Vector* Vector::createByPaddleVectorPtr(void* ptr) {
}
}
Vector
*
Vector
::
createVectorFromNumpy
(
float
*
data
,
int
dim
,
bool
copy
,
Vector
*
Vector
::
createVectorFromNumpy
(
float
*
data
,
int
dim
,
bool
copy
,
bool
useGpu
)
{
bool
useGpu
)
throw
(
UnsupportError
)
{
if
(
useGpu
)
{
if
(
useGpu
)
{
/// if use gpu only copy=True is supported
/// if use gpu only copy=True is supported
if
(
!
copy
)
{
if
(
!
copy
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录