Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
64bfd814
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
64bfd814
编写于
4月 15, 2017
作者:
Q
qiaolongfei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix style probelm
上级
bad503ff
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
26 addition
and
15 deletion
+26
-15
paddle/api/PaddleAPI.h
paddle/api/PaddleAPI.h
+5
-3
paddle/api/ParameterUpdater.cpp
paddle/api/ParameterUpdater.cpp
+7
-3
paddle/function/BufferArgTest.cpp
paddle/function/BufferArgTest.cpp
+1
-1
paddle/function/FunctionTest.cpp
paddle/function/FunctionTest.cpp
+1
-1
paddle/function/TensorShapeTest.cpp
paddle/function/TensorShapeTest.cpp
+1
-1
paddle/function/TensorTypeTest.cpp
paddle/function/TensorTypeTest.cpp
+1
-1
python/paddle/v2/optimizer.py
python/paddle/v2/optimizer.py
+2
-2
python/paddle/v2/trainer.py
python/paddle/v2/trainer.py
+8
-3
未找到文件。
paddle/api/PaddleAPI.h
浏览文件 @
64bfd814
...
...
@@ -19,9 +19,9 @@ limitations under the License. */
#include <stdexcept>
#include <string>
#include <vector>
#include "paddle/gserver/gradientmachines/GradientMachine.h"
#include "paddle/utils/Common.h"
#include "paddle/utils/GlobalConstants.h"
#include "paddle/gserver/gradientmachines/GradientMachine.h"
/// Import PaddlePaddle's enumeration into global namespace.
using
namespace
paddle
::
enumeration_wrapper
;
// NOLINT
...
...
@@ -470,7 +470,8 @@ private:
enum
GradientMatchineCreateMode
{
CREATE_MODE_NORMAL
=
paddle
::
GradientMachine
::
kNormal
,
CREATE_MODE_SGD_SPARSE_CPU_TRAINING
=
paddle
::
GradientMachine
::
kSgdSparseCpuTraining
,
CREATE_MODE_SGD_SPARSE_CPU_TRAINING
=
paddle
::
GradientMachine
::
kSgdSparseCpuTraining
,
CREATE_MODE_TESTING
=
paddle
::
GradientMachine
::
kTesting
};
...
...
@@ -819,7 +820,8 @@ private:
public:
static
ParameterUpdater
*
createLocalUpdater
(
OptimizationConfig
*
config
);
static
ParameterUpdater
*
createRemoteUpdater
(
OptimizationConfig
*
config
,
int
passCount
,
bool
userSparseUpdater
);
int
passCount
,
bool
userSparseUpdater
);
~
ParameterUpdater
();
/**
...
...
paddle/api/ParameterUpdater.cpp
浏览文件 @
64bfd814
...
...
@@ -32,12 +32,16 @@ ParameterUpdater *ParameterUpdater::createRemoteUpdater(
OptimizationConfig
*
config
,
int
passCount
,
bool
userSparseUpdater
)
{
auto
updater
=
new
ParameterUpdater
();
auto
remoteUpdater
=
new
paddle
::
RemoteParameterUpdater
(
config
->
m
->
getConfig
(),
passCount
,
nullptr
);
config
->
m
->
getConfig
(),
passCount
,
nullptr
);
if
(
userSparseUpdater
)
{
std
::
unique_ptr
<
paddle
::
ParameterUpdater
>
remoteUpdaterPtr
;
remoteUpdaterPtr
.
reset
(
remoteUpdater
);
auto
sparseRemoteUpdater
=
new
paddle
::
SparseRemoteParameterUpdaterComposite
(
config
->
m
->
getConfig
(),
passCount
,
false
,
std
::
move
(
remoteUpdaterPtr
));
auto
sparseRemoteUpdater
=
new
paddle
::
SparseRemoteParameterUpdaterComposite
(
config
->
m
->
getConfig
(),
passCount
,
false
,
std
::
move
(
remoteUpdaterPtr
));
updater
->
m
->
updater
.
reset
(
sparseRemoteUpdater
);
}
else
{
updater
->
m
->
updater
.
reset
(
remoteUpdater
);
...
...
paddle/function/BufferArgTest.cpp
浏览文件 @
64bfd814
...
...
@@ -12,8 +12,8 @@ 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 "BufferArg.h"
#include <gtest/gtest.h>
#include "BufferArg.h"
#include "paddle/math/MemoryHandle.h"
namespace
paddle
{
...
...
paddle/function/FunctionTest.cpp
浏览文件 @
64bfd814
...
...
@@ -12,8 +12,8 @@ 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 "Function.h"
#include <gtest/gtest.h>
#include "Function.h"
#include "paddle/math/SparseMatrix.h"
namespace
paddle
{
...
...
paddle/function/TensorShapeTest.cpp
浏览文件 @
64bfd814
...
...
@@ -12,8 +12,8 @@ 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 "TensorShape.h"
#include <gtest/gtest.h>
#include "TensorShape.h"
namespace
paddle
{
...
...
paddle/function/TensorTypeTest.cpp
浏览文件 @
64bfd814
...
...
@@ -12,8 +12,8 @@ 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 "TensorType.h"
#include <gtest/gtest.h>
#include "TensorType.h"
namespace
paddle
{
...
...
python/paddle/v2/optimizer.py
浏览文件 @
64bfd814
...
...
@@ -42,8 +42,8 @@ class Optimizer(object):
return
swig_api
.
ParameterUpdater
.
createLocalUpdater
(
self
.
__opt_conf__
)
def
create_remote_updater
(
self
,
pass_num
,
use_sparse_updater
):
return
swig_api
.
ParameterUpdater
.
createRemoteUpdater
(
self
.
__opt_conf__
,
pass_num
,
use_sparse_updater
)
return
swig_api
.
ParameterUpdater
.
createRemoteUpdater
(
self
.
__opt_conf__
,
pass_num
,
use_sparse_updater
)
class
Momentum
(
Optimizer
):
...
...
python/paddle/v2/trainer.py
浏览文件 @
64bfd814
...
...
@@ -42,7 +42,12 @@ class SGD(object):
:type extra_layers: paddle.v2.config_base.Layer
"""
def
__init__
(
self
,
cost
,
parameters
,
update_equation
,
extra_layers
=
None
,
is_local
=
True
):
def
__init__
(
self
,
cost
,
parameters
,
update_equation
,
extra_layers
=
None
,
is_local
=
True
):
if
not
isinstance
(
parameters
,
v2_parameters
.
Parameters
):
raise
TypeError
(
'parameters should be parameters'
)
...
...
@@ -97,8 +102,8 @@ class SGD(object):
if
self
.
__is_local__
:
updater
=
self
.
__optimizer__
.
create_local_updater
()
else
:
updater
=
self
.
__optimizer__
.
create_remote_updater
(
num_passes
,
self
.
__use_sparse_updater__
)
updater
=
self
.
__optimizer__
.
create_remote_updater
(
num_passes
,
self
.
__use_sparse_updater__
)
updater
.
init
(
self
.
__gradient_machine__
)
self
.
__gradient_machine__
.
start
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录