Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
d35ef9de
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看板
提交
d35ef9de
编写于
1月 09, 2017
作者:
H
hedaoyuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
follow commit
上级
ccf0b1bb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
11 deletion
+13
-11
paddle/function/BufferArg.h
paddle/function/BufferArg.h
+11
-9
paddle/function/TensorShape.h
paddle/function/TensorShape.h
+2
-2
未找到文件。
paddle/function/BufferArg.h
浏览文件 @
d35ef9de
...
@@ -56,7 +56,7 @@ public:
...
@@ -56,7 +56,7 @@ public:
:
buf_
(
buf
),
valueType_
(
valueType
)
{}
:
buf_
(
buf
),
valueType_
(
valueType
)
{}
BufferArg
(
const
Matrix
&
matrix
)
BufferArg
(
const
Matrix
&
matrix
)
:
buf_
(
(
void
*
)
matrix
.
getData
(
)),
:
buf_
(
reinterpret_cast
<
void
*>
(
matrix
.
getData
()
)),
valueType_
(
DataType
<
real
>::
value
),
valueType_
(
DataType
<
real
>::
value
),
shape_
(
2
)
{
shape_
(
2
)
{
shape_
.
setDim
(
0
,
matrix
.
getHeight
());
shape_
.
setDim
(
0
,
matrix
.
getHeight
());
...
@@ -64,21 +64,23 @@ public:
...
@@ -64,21 +64,23 @@ public:
}
}
BufferArg
(
const
Matrix
&
matrix
,
const
TensorShape
&
shape
)
BufferArg
(
const
Matrix
&
matrix
,
const
TensorShape
&
shape
)
:
buf_
(
(
void
*
)
matrix
.
getData
(
)),
:
buf_
(
reinterpret_cast
<
void
*>
(
matrix
.
getData
()
)),
valueType_
(
DataType
<
real
>::
value
),
valueType_
(
DataType
<
real
>::
value
),
shape_
(
shape
)
{
shape_
(
shape
)
{
CHECK_EQ
(
matrix
.
getElementCnt
(),
shape
.
getElements
());
CHECK_EQ
(
matrix
.
getElementCnt
(),
shape
.
getElements
());
}
}
BufferArg
(
const
Vector
&
vector
)
BufferArg
(
const
Vector
&
vector
)
:
buf_
(
(
void
*
)
vector
.
getData
(
)),
:
buf_
(
reinterpret_cast
<
void
*>
(
vector
.
getData
()
)),
valueType_
(
DataType
<
real
>::
value
),
valueType_
(
DataType
<
real
>::
value
),
shape_
(
1
)
{
shape_
(
1
)
{
shape_
.
setDim
(
0
,
vector
.
getSize
());
shape_
.
setDim
(
0
,
vector
.
getSize
());
}
}
BufferArg
(
const
IVector
&
vector
)
BufferArg
(
const
IVector
&
vector
)
:
buf_
((
void
*
)
vector
.
getData
()),
valueType_
(
VALUE_TYPE_INT32
),
shape_
(
1
)
{
:
buf_
(
reinterpret_cast
<
void
*>
(
vector
.
getData
())),
valueType_
(
VALUE_TYPE_INT32
),
shape_
(
1
)
{
shape_
.
setDim
(
0
,
vector
.
getSize
());
shape_
.
setDim
(
0
,
vector
.
getSize
());
}
}
...
@@ -129,7 +131,7 @@ protected:
...
@@ -129,7 +131,7 @@ protected:
// sequence start positions in a mini-batch of sequences
// sequence start positions in a mini-batch of sequences
// shape_.ndims() == 1
// shape_.ndims() == 1
// valueType_ = int32
// valueType_ = int32
// if a < b th
a
n value_.buf_[a] < value_.buf_[b]
// if a < b th
e
n value_.buf_[a] < value_.buf_[b]
class
SequenceIdArg
:
public
BufferArg
{
class
SequenceIdArg
:
public
BufferArg
{
public:
public:
SequenceIdArg
(
void
*
buf
,
const
TensorShape
&
shape
)
SequenceIdArg
(
void
*
buf
,
const
TensorShape
&
shape
)
...
@@ -203,13 +205,13 @@ public:
...
@@ -203,13 +205,13 @@ public:
SparseMatrixArg
(
const
CpuSparseMatrix
&
sparse
)
SparseMatrixArg
(
const
CpuSparseMatrix
&
sparse
)
:
BufferArg
(
sparse
),
:
BufferArg
(
sparse
),
row_
(
(
void
*
)
sparse
.
getRows
(
),
VALUE_TYPE_INT32
),
row_
(
reinterpret_cast
<
void
*>
(
sparse
.
getRows
()
),
VALUE_TYPE_INT32
),
col_
(
(
void
*
)
sparse
.
getCols
(
),
VALUE_TYPE_INT32
)
{}
col_
(
reinterpret_cast
<
void
*>
(
sparse
.
getCols
()
),
VALUE_TYPE_INT32
)
{}
SparseMatrixArg
(
const
GpuSparseMatrix
&
sparse
)
SparseMatrixArg
(
const
GpuSparseMatrix
&
sparse
)
:
BufferArg
(
sparse
),
:
BufferArg
(
sparse
),
row_
(
(
void
*
)
sparse
.
getRows
(
),
VALUE_TYPE_INT32
),
row_
(
reinterpret_cast
<
void
*>
(
sparse
.
getRows
()
),
VALUE_TYPE_INT32
),
col_
(
(
void
*
)
sparse
.
getCols
(
),
VALUE_TYPE_INT32
)
{}
col_
(
reinterpret_cast
<
void
*>
(
sparse
.
getCols
()
),
VALUE_TYPE_INT32
)
{}
~
SparseMatrixArg
()
{}
~
SparseMatrixArg
()
{}
...
...
paddle/function/TensorShape.h
浏览文件 @
d35ef9de
...
@@ -30,14 +30,14 @@ public:
...
@@ -30,14 +30,14 @@ public:
TensorShape
(
std
::
initializer_list
<
size_t
>
dims
)
{
TensorShape
(
std
::
initializer_list
<
size_t
>
dims
)
{
ndims_
=
dims
.
size
();
ndims_
=
dims
.
size
();
initDims
(
ndims_
);
initDims
(
ndims_
);
std
::
copy
(
dims
.
begin
(),
dims
.
end
(),
dims_
.
begin
()
);
dims_
.
assign
(
dims
);
numElements
();
numElements
();
};
};
TensorShape
(
const
TensorShape
&
t
)
TensorShape
(
const
TensorShape
&
t
)
:
ndims_
(
t
.
ndims_
),
nelements_
(
t
.
nelements_
)
{
:
ndims_
(
t
.
ndims_
),
nelements_
(
t
.
nelements_
)
{
initDims
(
ndims_
);
initDims
(
ndims_
);
std
::
copy
(
t
.
dims_
.
begin
(),
t
.
dims_
.
end
(),
dims_
.
begin
());
dims_
.
assign
(
t
.
dims_
.
begin
(),
t
.
dims_
.
end
());
};
};
// get the size of specified dimension
// get the size of specified dimension
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录