Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
d226daee
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d226daee
编写于
9月 22, 2017
作者:
S
superjom
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of github.com:PaddlePaddle/Paddle into feature/dynamic_batch
上级
e5bad90b
5b7fd00d
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
21 addition
and
21 deletion
+21
-21
paddle/framework/tensor.h
paddle/framework/tensor.h
+5
-8
paddle/framework/tensor_impl.h
paddle/framework/tensor_impl.h
+1
-2
paddle/operators/elementwise_add_op.h
paddle/operators/elementwise_add_op.h
+2
-0
paddle/operators/elementwise_div_op.h
paddle/operators/elementwise_div_op.h
+2
-0
paddle/operators/elementwise_sub_op.h
paddle/operators/elementwise_sub_op.h
+1
-0
paddle/pybind/pybind.cc
paddle/pybind/pybind.cc
+9
-10
paddle/pybind/tensor_py.h
paddle/pybind/tensor_py.h
+1
-1
未找到文件。
paddle/framework/tensor.h
浏览文件 @
d226daee
...
@@ -29,16 +29,19 @@ limitations under the License. */
...
@@ -29,16 +29,19 @@ limitations under the License. */
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
pybind
{
namespace
details
{
namespace
details
{
template
<
bool
less
,
size_t
i
,
typename
...
args
>
template
<
bool
less
,
size_t
i
,
typename
...
args
>
struct
CastToPyBufferImpl
;
struct
CastToPyBufferImpl
;
}
}
}
// namespace pybind
namespace
framework
{
class
Tensor
{
class
Tensor
{
public:
public:
template
<
bool
less
,
size_t
i
,
typename
...
args
>
template
<
bool
less
,
size_t
i
,
typename
...
args
>
friend
struct
details
::
CastToPyBufferImpl
;
friend
struct
pybind
::
details
::
CastToPyBufferImpl
;
template
<
typename
T
,
size_t
D
,
int
MajorType
,
typename
IndexType
>
template
<
typename
T
,
size_t
D
,
int
MajorType
,
typename
IndexType
>
friend
struct
EigenTensor
;
friend
struct
EigenTensor
;
...
@@ -165,12 +168,6 @@ class Tensor {
...
@@ -165,12 +168,6 @@ class Tensor {
/*! points to dimensions of memory block. */
/*! points to dimensions of memory block. */
DDim
dims_
;
DDim
dims_
;
/**
* A cache of the number of elements in a tensor.
* Would be 0 for an uninitialized tensor.
*/
int64_t
numel_
;
/**
/**
* @brief A PlaceHolder may be shared by more than one tensor.
* @brief A PlaceHolder may be shared by more than one tensor.
*
*
...
...
paddle/framework/tensor_impl.h
浏览文件 @
d226daee
...
@@ -147,13 +147,12 @@ inline Tensor Tensor::Slice(const int& begin_idx, const int& end_idx) const {
...
@@ -147,13 +147,12 @@ inline Tensor Tensor::Slice(const int& begin_idx, const int& end_idx) const {
inline
Tensor
&
Tensor
::
Resize
(
const
DDim
&
dims
)
{
inline
Tensor
&
Tensor
::
Resize
(
const
DDim
&
dims
)
{
dims_
=
dims
;
dims_
=
dims
;
numel_
=
product
(
dims_
);
return
*
this
;
return
*
this
;
}
}
inline
const
DDim
&
Tensor
::
dims
()
const
{
return
dims_
;
}
inline
const
DDim
&
Tensor
::
dims
()
const
{
return
dims_
;
}
inline
int64_t
Tensor
::
numel
()
const
{
return
numel_
;
}
inline
int64_t
Tensor
::
numel
()
const
{
return
product
(
dims_
)
;
}
template
<
typename
T
>
template
<
typename
T
>
inline
Tensor
ReshapeToMatrix
(
const
Tensor
&
src
,
int
num_col_dims
)
{
inline
Tensor
ReshapeToMatrix
(
const
Tensor
&
src
,
int
num_col_dims
)
{
...
...
paddle/operators/elementwise_add_op.h
浏览文件 @
d226daee
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
#pragma once
#include "paddle/operators/elementwise_op.h"
#include "paddle/operators/elementwise_op.h"
namespace
paddle
{
namespace
paddle
{
...
...
paddle/operators/elementwise_div_op.h
浏览文件 @
d226daee
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
#pragma once
#include "paddle/operators/elementwise_op.h"
#include "paddle/operators/elementwise_op.h"
namespace
paddle
{
namespace
paddle
{
...
...
paddle/operators/elementwise_sub_op.h
浏览文件 @
d226daee
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
#pragma once
#include "paddle/operators/elementwise_op.h"
#include "paddle/operators/elementwise_op.h"
namespace
paddle
{
namespace
paddle
{
...
...
paddle/pybind/pybind.cc
浏览文件 @
d226daee
...
@@ -34,12 +34,7 @@ limitations under the License. */
...
@@ -34,12 +34,7 @@ limitations under the License. */
namespace
py
=
pybind11
;
namespace
py
=
pybind11
;
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
pybind
{
using
Tensor
=
framework
::
Tensor
;
using
LoDTensor
=
framework
::
LoDTensor
;
using
LoD
=
framework
::
LoD
;
static
size_t
UniqueIntegerGenerator
()
{
static
size_t
UniqueIntegerGenerator
()
{
static
std
::
atomic
<
size_t
>
generator
;
static
std
::
atomic
<
size_t
>
generator
;
return
generator
.
fetch_add
(
1
);
return
generator
.
fetch_add
(
1
);
...
@@ -56,6 +51,10 @@ bool IsCompileGPU() {
...
@@ -56,6 +51,10 @@ bool IsCompileGPU() {
PYBIND11_PLUGIN
(
core
)
{
PYBIND11_PLUGIN
(
core
)
{
py
::
module
m
(
"core"
,
"C++ core of PaddlePaddle"
);
py
::
module
m
(
"core"
,
"C++ core of PaddlePaddle"
);
// using framework in this function. Since it is inside a function, it will
// not cause namespace pollution.
using
namespace
paddle
::
framework
;
// NOLINT
py
::
class_
<
Tensor
>
(
m
,
"Tensor"
,
py
::
buffer_protocol
())
py
::
class_
<
Tensor
>
(
m
,
"Tensor"
,
py
::
buffer_protocol
())
.
def_buffer
(
.
def_buffer
(
[](
Tensor
&
self
)
->
py
::
buffer_info
{
return
CastToPyBuffer
(
self
);
})
[](
Tensor
&
self
)
->
py
::
buffer_info
{
return
CastToPyBuffer
(
self
);
})
...
@@ -107,7 +106,7 @@ PYBIND11_PLUGIN(core) {
...
@@ -107,7 +106,7 @@ PYBIND11_PLUGIN(core) {
#ifdef PADDLE_ONLY_CPU
#ifdef PADDLE_ONLY_CPU
new
(
&
instance
)
LoDTensor
(
lod
);
new
(
&
instance
)
LoDTensor
(
lod
);
#else
#else
paddle
::
framework
::
LoD
new_lod
;
LoD
new_lod
;
new_lod
.
reserve
(
lod
.
size
());
new_lod
.
reserve
(
lod
.
size
());
std
::
copy
(
lod
.
begin
(),
lod
.
end
(),
std
::
back_inserter
(
new_lod
));
std
::
copy
(
lod
.
begin
(),
lod
.
end
(),
std
::
back_inserter
(
new_lod
));
new
(
&
instance
)
LoDTensor
(
new_lod
);
new
(
&
instance
)
LoDTensor
(
new_lod
);
...
@@ -118,7 +117,7 @@ PYBIND11_PLUGIN(core) {
...
@@ -118,7 +117,7 @@ PYBIND11_PLUGIN(core) {
#ifdef PADDLE_ONLY_CPU
#ifdef PADDLE_ONLY_CPU
self
.
set_lod
(
lod
);
self
.
set_lod
(
lod
);
#else
#else
paddle
::
framework
::
LoD
new_lod
;
LoD
new_lod
;
new_lod
.
reserve
(
lod
.
size
());
new_lod
.
reserve
(
lod
.
size
());
std
::
copy
(
lod
.
begin
(),
lod
.
end
(),
std
::
back_inserter
(
new_lod
));
std
::
copy
(
lod
.
begin
(),
lod
.
end
(),
std
::
back_inserter
(
new_lod
));
self
.
set_lod
(
new_lod
);
self
.
set_lod
(
new_lod
);
...
@@ -132,7 +131,7 @@ PYBIND11_PLUGIN(core) {
...
@@ -132,7 +131,7 @@ PYBIND11_PLUGIN(core) {
std
::
vector
<
std
::
vector
<
size_t
>>
new_lod
;
std
::
vector
<
std
::
vector
<
size_t
>>
new_lod
;
new_lod
.
reserve
(
lod
.
size
());
new_lod
.
reserve
(
lod
.
size
());
std
::
transform
(
lod
.
begin
(),
lod
.
end
(),
std
::
back_inserter
(
new_lod
),
std
::
transform
(
lod
.
begin
(),
lod
.
end
(),
std
::
back_inserter
(
new_lod
),
[](
paddle
::
framework
::
Vector
<
size_t
>
item
)
->
[](
Vector
<
size_t
>
item
)
->
std
::
vector
<
size_t
>
{
std
::
vector
<
size_t
>
{
std
::
vector
<
size_t
>
v
;
std
::
vector
<
size_t
>
v
;
v
.
reserve
(
item
.
size
());
v
.
reserve
(
item
.
size
());
...
@@ -317,5 +316,5 @@ All parameter, weight, gradient are variables in Paddle.
...
@@ -317,5 +316,5 @@ All parameter, weight, gradient are variables in Paddle.
return
m
.
ptr
();
return
m
.
ptr
();
}
}
}
// namespace
framework
}
// namespace
pybind
}
// namespace paddle
}
// namespace paddle
paddle/pybind/tensor_py.h
浏览文件 @
d226daee
...
@@ -23,7 +23,7 @@ namespace py = pybind11;
...
@@ -23,7 +23,7 @@ namespace py = pybind11;
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
pybind
{
namespace
details
{
namespace
details
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录