Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
76b63c25
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
76b63c25
编写于
5月 07, 2018
作者:
Y
Yancey
提交者:
GitHub
5月 07, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move transpiler files into transpiler folder (#10415)
上级
55e714e0
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
47 addition
and
36 deletion
+47
-36
python/paddle/fluid/__init__.py
python/paddle/fluid/__init__.py
+3
-10
python/paddle/fluid/transpiler/__init__.py
python/paddle/fluid/transpiler/__init__.py
+22
-0
python/paddle/fluid/transpiler/distribute_transpiler.py
python/paddle/fluid/transpiler/distribute_transpiler.py
+14
-14
python/paddle/fluid/transpiler/distribute_transpiler_simple.py
...n/paddle/fluid/transpiler/distribute_transpiler_simple.py
+2
-4
python/paddle/fluid/transpiler/distributed_splitter.py
python/paddle/fluid/transpiler/distributed_splitter.py
+0
-0
python/paddle/fluid/transpiler/inference_transpiler.py
python/paddle/fluid/transpiler/inference_transpiler.py
+3
-3
python/paddle/fluid/transpiler/memory_optimization_transpiler.py
...paddle/fluid/transpiler/memory_optimization_transpiler.py
+3
-5
未找到文件。
python/paddle/fluid/__init__.py
浏览文件 @
76b63c25
...
...
@@ -40,16 +40,14 @@ import backward
import
regularizer
import
average
import
metrics
import
transpiler
from
param_attr
import
ParamAttr
,
WeightNormParamAttr
from
data_feeder
import
DataFeeder
from
core
import
LoDTensor
,
CPUPlace
,
CUDAPlace
,
CUDAPinnedPlace
from
distribute_transpiler
import
DistributeTranspiler
from
distribute_transpiler_simple
import
SimpleDistributeTranspiler
from
transpiler
import
DistributeTranspiler
,
SimpleDistributeTranspiler
,
InferenceTranspiler
,
memory_optimize
,
release_memory
from
concurrency
import
(
Go
,
make_channel
,
channel_send
,
channel_recv
,
channel_close
,
Select
)
from
inference_transpiler
import
InferenceTranspiler
import
clip
from
memory_optimization_transpiler
import
memory_optimize
,
release_memory
import
profiler
import
unique_name
import
recordio_writer
...
...
@@ -58,7 +56,7 @@ from parallel_executor import ParallelExecutor
Tensor
=
LoDTensor
__all__
=
framework
.
__all__
+
executor
.
__all__
+
concurrency
.
__all__
+
\
trainer
.
__all__
+
inferencer
.
__all__
+
[
trainer
.
__all__
+
inferencer
.
__all__
+
transpiler
.
__all__
+
[
'io'
,
'initializer'
,
'layers'
,
...
...
@@ -76,11 +74,6 @@ __all__ = framework.__all__ + executor.__all__ + concurrency.__all__ +\
'WeightNormParamAttr'
,
'DataFeeder'
,
'clip'
,
'SimpleDistributeTranspiler'
,
'DistributeTranspiler'
,
'InferenceTranspiler'
,
'memory_optimize'
,
'release_memory'
,
'profiler'
,
'unique_name'
,
'recordio_writer'
,
...
...
python/paddle/fluid/transpiler/__init__.py
0 → 100644
浏览文件 @
76b63c25
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# 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.
from
distribute_transpiler
import
DistributeTranspiler
from
inference_transpiler
import
InferenceTranspiler
from
memory_optimization_transpiler
import
memory_optimize
,
release_memory
from
distribute_transpiler_simple
import
SimpleDistributeTranspiler
__all__
=
[
"DistributeTranspiler"
,
"InferenceTranspiler"
,
"SimpleDistributeTranspiler"
,
"memory_optimize"
,
"release_memory"
]
python/paddle/fluid/distribute_transpiler.py
→
python/paddle/fluid/
transpiler/
distribute_transpiler.py
浏览文件 @
76b63c25
...
...
@@ -17,9 +17,8 @@ from __future__ import print_function
import
math
import
distributed_splitter
as
splitter
import
framework
from
framework
import
Program
,
default_main_program
,
Variable
,
Parameter
from
.
import
core
from
..
import
core
from
..framework
import
Program
,
default_main_program
,
Variable
,
Parameter
LOOKUP_TABLE_TYPE
=
"lookup_table"
LOOKUP_TABLE_GRAD_TYPE
=
"lookup_table_grad"
...
...
@@ -135,6 +134,16 @@ def split_dense_variable(var_list,
return
blocks
def
delete_ops
(
block
,
ops
):
try
:
start
=
list
(
block
.
ops
).
index
(
ops
[
0
])
end
=
list
(
block
.
ops
).
index
(
ops
[
-
1
])
[
block
.
remove_op
(
start
)
for
_
in
xrange
(
end
-
start
+
1
)]
except
Exception
,
e
:
raise
e
block
.
program
.
sync_with_cpp
()
class
DistributeTranspiler
:
def
transpile
(
self
,
trainer_id
,
...
...
@@ -317,7 +326,7 @@ class DistributeTranspiler:
def
get_trainer_program
(
self
):
# remove optimize ops and add a send op to main_program
self
.
delete_ops
(
self
.
origin_program
.
global_block
(),
self
.
optimize_ops
)
delete_ops
(
self
.
origin_program
.
global_block
(),
self
.
optimize_ops
)
# FIXME(typhoonzero): serialize once will fix error occurs when clone.
self
.
origin_program
.
__str__
()
return
self
.
origin_program
...
...
@@ -601,7 +610,7 @@ class DistributeTranspiler:
attrs
=
{
"axis"
:
0
})
# delete lookup_table_op
self
.
delete_ops
(
program
.
global_block
(),
[
op
])
delete_ops
(
program
.
global_block
(),
[
op
])
# break for loop
break
...
...
@@ -1164,12 +1173,3 @@ class DistributeTranspiler:
in_name
.
startswith
(
"beta2_pow_acc"
):
return
True
return
False
def
delete_ops
(
self
,
block
,
ops
):
try
:
start
=
list
(
block
.
ops
).
index
(
ops
[
0
])
end
=
list
(
block
.
ops
).
index
(
ops
[
-
1
])
[
block
.
remove_op
(
start
)
for
_
in
xrange
(
end
-
start
+
1
)]
except
Exception
,
e
:
raise
e
block
.
program
.
sync_with_cpp
()
python/paddle/fluid/distribute_transpiler_simple.py
→
python/paddle/fluid/
transpiler/
distribute_transpiler_simple.py
浏览文件 @
76b63c25
...
...
@@ -12,10 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
framework
from
framework
import
Program
,
default_main_program
,
Parameter
,
Variable
import
optimizer
from
layer_helper
import
LayerHelper
from
..framework
import
Program
,
default_main_program
,
Parameter
,
Variable
from
..layer_helper
import
LayerHelper
def
hash_name_to_server
(
params_grads
,
pserver_endpoints
):
...
...
python/paddle/fluid/distributed_splitter.py
→
python/paddle/fluid/
transpiler/
distributed_splitter.py
浏览文件 @
76b63c25
文件已移动
python/paddle/fluid/inference_transpiler.py
→
python/paddle/fluid/
transpiler/
inference_transpiler.py
浏览文件 @
76b63c25
...
...
@@ -13,9 +13,9 @@
# limitations under the License.
import
numpy
as
np
from
framework
import
Program
from
executor
import
global_scope
from
.
import
cor
e
from
..
import
core
from
..framework
import
Program
from
.
.executor
import
global_scop
e
class
InferenceTranspiler
:
...
...
python/paddle/fluid/memory_optimization_transpiler.py
→
python/paddle/fluid/
transpiler/
memory_optimization_transpiler.py
浏览文件 @
76b63c25
...
...
@@ -13,11 +13,9 @@
# limitations under the License.
from
collections
import
defaultdict
import
framework
from
framework
import
Program
,
default_main_program
,
Parameter
,
Variable
import
backward
from
backward
import
_rename_arg_
from
.
import
core
from
..
import
core
from
..framework
import
Program
,
default_main_program
,
Parameter
,
Variable
from
..backward
import
_rename_arg_
dtype_to_size
=
{
core
.
VarDesc
.
VarType
.
FP16
:
2
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录