Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
620575b6
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看板
提交
620575b6
编写于
7月 15, 2017
作者:
L
liaogang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FIX: cpplint code style
上级
13b0dcd2
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
81 addition
and
25 deletion
+81
-25
paddle/framework/ddim.cc
paddle/framework/ddim.cc
+28
-14
paddle/framework/ddim.h
paddle/framework/ddim.h
+1
-1
paddle/framework/net.cc
paddle/framework/net.cc
+16
-0
paddle/framework/op_registry.cc
paddle/framework/op_registry.cc
+15
-1
paddle/framework/operator.cc
paddle/framework/operator.cc
+1
-1
paddle/memory/detail/memory_block.cc
paddle/memory/detail/memory_block.cc
+3
-3
paddle/memory/memory.cc
paddle/memory/memory.cc
+0
-2
paddle/platform/cpu_info.cc
paddle/platform/cpu_info.cc
+2
-2
paddle/platform/place.cc
paddle/platform/place.cc
+15
-1
未找到文件。
paddle/framework/ddim.cc
浏览文件 @
620575b6
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/framework/ddim.h"
namespace
paddle
{
namespace
framework
{
///@cond HIDDEN
///
@cond HIDDEN
template
<
int
i
>
Dim
<
i
>
make_dim
(
const
int
*
d
)
{
...
...
@@ -50,7 +64,7 @@ void make_ddim(DDim& ddim, const int* dims, int n) {
}
}
///@endcond
///
@endcond
DDim
make_ddim
(
std
::
initializer_list
<
int
>
dims
)
{
DDim
result
(
make_dim
(
0
));
...
...
@@ -64,11 +78,11 @@ DDim make_ddim(const std::vector<int>& dims) {
return
result
;
}
///@cond HIDDEN
///
@cond HIDDEN
// XXX For some reason, putting this in an anonymous namespace causes errors
class
DynamicMutableIndexer
:
public
boost
::
static_visitor
<
int
&>
{
public:
DynamicMutableIndexer
(
int
idx
)
:
idx_
(
idx
)
{}
explicit
DynamicMutableIndexer
(
int
idx
)
:
idx_
(
idx
)
{}
template
<
int
D
>
int
&
operator
()(
Dim
<
D
>&
dim
)
const
{
...
...
@@ -81,7 +95,7 @@ class DynamicMutableIndexer : public boost::static_visitor<int&> {
class
DynamicConstIndexer
:
public
boost
::
static_visitor
<
int
>
{
public:
DynamicConstIndexer
(
int
idx
)
:
idx_
(
idx
)
{}
explicit
DynamicConstIndexer
(
int
idx
)
:
idx_
(
idx
)
{}
template
<
int
D
>
int
operator
()(
const
Dim
<
D
>&
dim
)
const
{
...
...
@@ -92,7 +106,7 @@ class DynamicConstIndexer : public boost::static_visitor<int> {
int
idx_
;
};
///@endcond
///
@endcond
int
&
DDim
::
operator
[](
int
idx
)
{
return
boost
::
apply_visitor
(
DynamicMutableIndexer
(
idx
),
var
);
...
...
@@ -155,11 +169,11 @@ int get(const DDim& ddim, int idx) { return ddim[idx]; }
void
set
(
DDim
&
ddim
,
int
idx
,
int
value
)
{
ddim
[
idx
]
=
value
;
}
///@cond HIDDEN
///
@cond HIDDEN
struct
VectorizeVisitor
:
public
boost
::
static_visitor
<>
{
std
::
vector
<
int
>&
vector
;
VectorizeVisitor
(
std
::
vector
<
int
>&
v
)
:
vector
(
v
)
{}
explicit
VectorizeVisitor
(
std
::
vector
<
int
>&
v
)
:
vector
(
v
)
{}
template
<
typename
T
>
void
operator
()(
const
T
&
t
)
{
...
...
@@ -169,7 +183,7 @@ struct VectorizeVisitor : public boost::static_visitor<> {
void
operator
()(
const
Dim
<
1
>&
t
)
{
vector
.
push_back
(
t
.
head
);
}
};
///@endcond
///
@endcond
std
::
vector
<
int
>
vectorize
(
const
DDim
&
ddim
)
{
std
::
vector
<
int
>
result
;
...
...
@@ -187,7 +201,7 @@ ssize_t product(const DDim& ddim) {
return
result
;
}
///\cond HIDDEN
///
\cond HIDDEN
struct
ArityVisitor
:
boost
::
static_visitor
<
int
>
{
template
<
int
D
>
...
...
@@ -196,15 +210,15 @@ struct ArityVisitor : boost::static_visitor<int> {
}
};
///\endcond
///
\endcond
int
arity
(
const
DDim
&
d
)
{
return
boost
::
apply_visitor
(
ArityVisitor
(),
d
);
}
///\cond HIDDEN
///
\cond HIDDEN
struct
DDimPrinter
:
boost
::
static_visitor
<
void
>
{
std
::
ostream
&
os
;
DDimPrinter
(
std
::
ostream
&
os_
)
:
os
(
os_
)
{}
explicit
DDimPrinter
(
std
::
ostream
&
os_
)
:
os
(
os_
)
{}
template
<
typename
T
>
void
operator
()(
const
T
&
t
)
{
...
...
@@ -212,7 +226,7 @@ struct DDimPrinter : boost::static_visitor<void> {
}
};
///\endcond
///
\endcond
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
DDim
&
ddim
)
{
DDimPrinter
printer
(
os
);
...
...
paddle/framework/ddim.h
浏览文件 @
620575b6
...
...
@@ -27,7 +27,7 @@ struct DDim {
DDim
()
:
var
(
Dim
<
1
>
())
{}
template
<
int
D
>
DDim
(
const
Dim
<
D
>&
in
)
:
var
(
in
)
{}
explicit
DDim
(
const
Dim
<
D
>&
in
)
:
var
(
in
)
{}
template
<
int
D
>
DDim
&
operator
=
(
const
Dim
<
D
>&
in
)
{
...
...
paddle/framework/net.cc
浏览文件 @
620575b6
/*
Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "paddle/framework/net.h"
namespace
paddle
{
...
...
paddle/framework/op_registry.cc
浏览文件 @
620575b6
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include <paddle/framework/op_registry.h>
namespace
paddle
{
...
...
@@ -33,4 +47,4 @@ void AttrTypeHelper::SetAttrType<std::vector<std::string>>(AttrProto* attr) {
attr
->
set_type
(
paddle
::
framework
::
AttrType
::
STRINGS
);
}
}
// namespace framework
}
// namespace paddle
\ No newline at end of file
}
// namespace paddle
paddle/framework/operator.cc
浏览文件 @
620575b6
...
...
@@ -40,4 +40,4 @@ std::string OperatorBase::DebugString() const {
}
}
// namespace framework
}
// namespace paddle
\ No newline at end of file
}
// namespace paddle
paddle/memory/detail/memory_block.cc
浏览文件 @
620575b6
...
...
@@ -152,6 +152,6 @@ MemoryBlock* MemoryBlock::metadata() const {
reinterpret_cast
<
const
Metadata
*>
(
this
)
-
1
));
}
}
// detail
}
// memory
}
// paddle
}
//
namespace
detail
}
//
namespace
memory
}
//
namespace
paddle
paddle/memory/memory.cc
浏览文件 @
620575b6
...
...
@@ -17,8 +17,6 @@ limitations under the License. */
#include "paddle/memory/detail/system_allocator.h"
#include "paddle/platform/assert.h"
#include <boost/variant.hpp>
namespace
paddle
{
namespace
memory
{
...
...
paddle/platform/cpu_info.cc
浏览文件 @
620575b6
...
...
@@ -41,8 +41,8 @@ inline size_t CpuTotalPhysicalMemory() {
if
(
sysctl
(
mib
,
2
,
&
size
,
&
len
,
NULL
,
0
)
==
0
)
return
(
size_t
)
size
;
return
0L
;
#else
long
pages
=
sysconf
(
_SC_PHYS_PAGES
);
long
page_size
=
sysconf
(
_SC_PAGE_SIZE
);
int64_t
pages
=
sysconf
(
_SC_PHYS_PAGES
);
int64_t
page_size
=
sysconf
(
_SC_PAGE_SIZE
);
return
pages
*
page_size
;
#endif
}
...
...
paddle/platform/place.cc
浏览文件 @
620575b6
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/platform/place.h"
namespace
paddle
{
...
...
@@ -7,7 +21,7 @@ namespace detail {
class
PlacePrinter
:
public
boost
::
static_visitor
<>
{
public:
PlacePrinter
(
std
::
ostream
&
os
)
:
os_
(
os
)
{}
explicit
PlacePrinter
(
std
::
ostream
&
os
)
:
os_
(
os
)
{}
void
operator
()(
const
CPUPlace
&
)
{
os_
<<
"CPUPlace"
;
}
void
operator
()(
const
GPUPlace
&
p
)
{
os_
<<
"GPUPlace("
<<
p
.
device
<<
")"
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录