Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
7e399b06
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7e399b06
编写于
2月 12, 2019
作者:
S
sneaxiy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename
test=develop
上级
42f6d0f8
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
35 addition
and
35 deletion
+35
-35
python/paddle/fluid/contrib/decoder/beam_search_decoder.py
python/paddle/fluid/contrib/decoder/beam_search_decoder.py
+3
-3
python/paddle/fluid/contrib/inferencer.py
python/paddle/fluid/contrib/inferencer.py
+2
-2
python/paddle/fluid/contrib/trainer.py
python/paddle/fluid/contrib/trainer.py
+2
-2
python/paddle/fluid/executor.py
python/paddle/fluid/executor.py
+2
-2
python/paddle/fluid/framework.py
python/paddle/fluid/framework.py
+7
-7
python/paddle/fluid/imperative/base.py
python/paddle/fluid/imperative/base.py
+2
-2
python/paddle/fluid/initializer.py
python/paddle/fluid/initializer.py
+2
-2
python/paddle/fluid/layers/control_flow.py
python/paddle/fluid/layers/control_flow.py
+2
-2
python/paddle/fluid/layers/io.py
python/paddle/fluid/layers/io.py
+2
-2
python/paddle/fluid/optimizer.py
python/paddle/fluid/optimizer.py
+2
-2
python/paddle/fluid/profiler.py
python/paddle/fluid/profiler.py
+3
-3
python/paddle/fluid/recordio_writer.py
python/paddle/fluid/recordio_writer.py
+2
-2
python/paddle/fluid/unique_name.py
python/paddle/fluid/unique_name.py
+2
-2
python/paddle/fluid/wrapped_decorator.py
python/paddle/fluid/wrapped_decorator.py
+2
-2
未找到文件。
python/paddle/fluid/contrib/decoder/beam_search_decoder.py
浏览文件 @
7e399b06
...
@@ -22,7 +22,7 @@ This API is still under active development and may change drastically.
...
@@ -22,7 +22,7 @@ This API is still under active development and may change drastically.
from
__future__
import
print_function
from
__future__
import
print_function
from
...wrapped_decorator
import
contextmanager
from
...wrapped_decorator
import
signature_safe_
contextmanager
import
numpy
as
np
import
numpy
as
np
import
six
import
six
...
@@ -419,7 +419,7 @@ class TrainingDecoder(object):
...
@@ -419,7 +419,7 @@ class TrainingDecoder(object):
self
.
_state_cell
=
state_cell
self
.
_state_cell
=
state_cell
self
.
_state_cell
.
_enter_decoder
(
self
)
self
.
_state_cell
.
_enter_decoder
(
self
)
@
contextmanager
@
signature_safe_
contextmanager
def
block
(
self
):
def
block
(
self
):
"""
"""
Define the behavior of the decoder for each RNN time step.
Define the behavior of the decoder for each RNN time step.
...
@@ -613,7 +613,7 @@ class BeamSearchDecoder(object):
...
@@ -613,7 +613,7 @@ class BeamSearchDecoder(object):
self
.
_word_dim
=
word_dim
self
.
_word_dim
=
word_dim
self
.
_input_var_dict
=
input_var_dict
self
.
_input_var_dict
=
input_var_dict
@
contextmanager
@
signature_safe_
contextmanager
def
block
(
self
):
def
block
(
self
):
"""
"""
Define the behavior of the decoder for each RNN time step.
Define the behavior of the decoder for each RNN time step.
...
...
python/paddle/fluid/contrib/inferencer.py
浏览文件 @
7e399b06
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
from
__future__
import
print_function
from
__future__
import
print_function
from
..wrapped_decorator
import
contextmanager
from
..wrapped_decorator
import
signature_safe_
contextmanager
from
..
import
core
from
..
import
core
...
@@ -105,7 +105,7 @@ class Inferencer(object):
...
@@ -105,7 +105,7 @@ class Inferencer(object):
return
results
return
results
@
contextmanager
@
signature_safe_
contextmanager
def
_prog_and_scope_guard
(
self
):
def
_prog_and_scope_guard
(
self
):
with
framework
.
program_guard
(
main_program
=
self
.
inference_program
):
with
framework
.
program_guard
(
main_program
=
self
.
inference_program
):
with
executor
.
scope_guard
(
self
.
scope
):
with
executor
.
scope_guard
(
self
.
scope
):
...
...
python/paddle/fluid/contrib/trainer.py
浏览文件 @
7e399b06
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
from
__future__
import
print_function
from
__future__
import
print_function
from
..wrapped_decorator
import
contextmanager
from
..wrapped_decorator
import
signature_safe_
contextmanager
import
os
import
os
import
errno
import
errno
import
shutil
import
shutil
...
@@ -453,7 +453,7 @@ class Trainer(object):
...
@@ -453,7 +453,7 @@ class Trainer(object):
io
.
save_inference_model
(
param_path
,
feeded_var_names
,
target_vars
,
io
.
save_inference_model
(
param_path
,
feeded_var_names
,
target_vars
,
exe
)
exe
)
@
contextmanager
@
signature_safe_
contextmanager
def
_prog_and_scope_guard
(
self
):
def
_prog_and_scope_guard
(
self
):
with
framework
.
program_guard
(
with
framework
.
program_guard
(
main_program
=
self
.
train_program
,
main_program
=
self
.
train_program
,
...
...
python/paddle/fluid/executor.py
浏览文件 @
7e399b06
...
@@ -17,7 +17,7 @@ from __future__ import print_function
...
@@ -17,7 +17,7 @@ from __future__ import print_function
import
os
import
os
import
multiprocessing
import
multiprocessing
import
numpy
as
np
import
numpy
as
np
from
.wrapped_decorator
import
contextmanager
from
.wrapped_decorator
import
signature_safe_
contextmanager
import
six
import
six
from
.framework
import
Program
,
default_main_program
,
Variable
from
.framework
import
Program
,
default_main_program
,
Variable
from
.
import
core
from
.
import
core
...
@@ -49,7 +49,7 @@ def _switch_scope(scope):
...
@@ -49,7 +49,7 @@ def _switch_scope(scope):
return
ex
return
ex
@
contextmanager
@
signature_safe_
contextmanager
def
scope_guard
(
scope
):
def
scope_guard
(
scope
):
"""
"""
Change the global/default scope instance by Python `with` statement. All
Change the global/default scope instance by Python `with` statement. All
...
...
python/paddle/fluid/framework.py
浏览文件 @
7e399b06
...
@@ -16,7 +16,7 @@ from __future__ import print_function
...
@@ -16,7 +16,7 @@ from __future__ import print_function
import
collections
import
collections
from
collections
import
defaultdict
from
collections
import
defaultdict
from
.wrapped_decorator
import
contextmanager
from
.wrapped_decorator
import
signature_safe_
contextmanager
import
os
import
os
import
re
import
re
import
traceback
import
traceback
...
@@ -111,7 +111,7 @@ class NameScope(object):
...
@@ -111,7 +111,7 @@ class NameScope(object):
_name_scope
=
NameScope
()
_name_scope
=
NameScope
()
@
contextmanager
@
signature_safe_
contextmanager
def
name_scope
(
prefix
=
None
):
def
name_scope
(
prefix
=
None
):
"""
"""
Generate hierarchical name prefix for the operators.
Generate hierarchical name prefix for the operators.
...
@@ -1775,7 +1775,7 @@ class Program(object):
...
@@ -1775,7 +1775,7 @@ class Program(object):
def
set_op_role_var
(
self
,
var_name
):
def
set_op_role_var
(
self
,
var_name
):
self
.
_op_role_var
=
[
var_name
]
self
.
_op_role_var
=
[
var_name
]
@
contextmanager
@
signature_safe_
contextmanager
def
_optimized_guard
(
self
,
param_and_grads
):
def
_optimized_guard
(
self
,
param_and_grads
):
"""
"""
A with guard to set :code:`Optimization` :code:`OpRole` and
A with guard to set :code:`Optimization` :code:`OpRole` and
...
@@ -1805,7 +1805,7 @@ class Program(object):
...
@@ -1805,7 +1805,7 @@ class Program(object):
self
.
_op_role_var
=
tmp_var
self
.
_op_role_var
=
tmp_var
self
.
_current_role
=
tmp_role
self
.
_current_role
=
tmp_role
@
contextmanager
@
signature_safe_
contextmanager
def
_lr_schedule_guard
(
self
,
is_with_opt
=
False
):
def
_lr_schedule_guard
(
self
,
is_with_opt
=
False
):
"""
"""
A with guard to set :code:`LRSched` :code:`OpRole` and
A with guard to set :code:`LRSched` :code:`OpRole` and
...
@@ -2459,7 +2459,7 @@ def switch_startup_program(program):
...
@@ -2459,7 +2459,7 @@ def switch_startup_program(program):
return
prev_program
return
prev_program
@
contextmanager
@
signature_safe_
contextmanager
def
program_guard
(
main_program
,
startup_program
=
None
):
def
program_guard
(
main_program
,
startup_program
=
None
):
"""
"""
Change the global main program and startup program with `with` statement.
Change the global main program and startup program with `with` statement.
...
@@ -2524,7 +2524,7 @@ def _get_var(name, program=None):
...
@@ -2524,7 +2524,7 @@ def _get_var(name, program=None):
return
program
.
global_block
().
var
(
name
)
return
program
.
global_block
().
var
(
name
)
@
contextmanager
@
signature_safe_
contextmanager
def
_imperative_guard
(
tracer
):
def
_imperative_guard
(
tracer
):
global
_imperative_tracer_
global
_imperative_tracer_
tmp_trace
=
_imperative_tracer_
tmp_trace
=
_imperative_tracer_
...
@@ -2535,7 +2535,7 @@ def _imperative_guard(tracer):
...
@@ -2535,7 +2535,7 @@ def _imperative_guard(tracer):
_imperative_tracer_
=
tmp_trace
_imperative_tracer_
=
tmp_trace
@
contextmanager
@
signature_safe_
contextmanager
def
_imperative_place_guard
(
place
):
def
_imperative_place_guard
(
place
):
global
_imperative_current_expected_place_
global
_imperative_current_expected_place_
tmp_place
=
_imperative_current_expected_place_
tmp_place
=
_imperative_current_expected_place_
...
...
python/paddle/fluid/imperative/base.py
浏览文件 @
7e399b06
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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.
from
..wrapped_decorator
import
contextmanager
from
..wrapped_decorator
import
signature_safe_
contextmanager
import
numpy
as
np
import
numpy
as
np
from
paddle.fluid
import
core
from
paddle.fluid
import
core
...
@@ -24,7 +24,7 @@ def enabled():
...
@@ -24,7 +24,7 @@ def enabled():
return
framework
.
_in_imperative_mode
()
return
framework
.
_in_imperative_mode
()
@
contextmanager
@
signature_safe_
contextmanager
def
guard
(
place
=
None
):
def
guard
(
place
=
None
):
train
=
framework
.
Program
()
train
=
framework
.
Program
()
startup
=
framework
.
Program
()
startup
=
framework
.
Program
()
...
...
python/paddle/fluid/initializer.py
浏览文件 @
7e399b06
...
@@ -16,7 +16,7 @@ from __future__ import print_function
...
@@ -16,7 +16,7 @@ from __future__ import print_function
from
.
import
framework
from
.
import
framework
import
numpy
as
np
import
numpy
as
np
from
.wrapped_decorator
import
contextmanager
from
.wrapped_decorator
import
signature_safe_
contextmanager
from
.core
import
VarDesc
from
.core
import
VarDesc
from
.
import
unique_name
from
.
import
unique_name
...
@@ -49,7 +49,7 @@ def force_init_on_cpu():
...
@@ -49,7 +49,7 @@ def force_init_on_cpu():
return
_force_init_on_cpu_
return
_force_init_on_cpu_
@
contextmanager
@
signature_safe_
contextmanager
def
init_on_cpu
():
def
init_on_cpu
():
"""
"""
Force the variable to be inited on CPU.
Force the variable to be inited on CPU.
...
...
python/paddle/fluid/layers/control_flow.py
浏览文件 @
7e399b06
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
# limitations under the License.
# limitations under the License.
from
__future__
import
print_function
from
__future__
import
print_function
from
..wrapped_decorator
import
contextmanager
from
..wrapped_decorator
import
signature_safe_
contextmanager
from
.layer_function_generator
import
autodoc
,
templatedoc
from
.layer_function_generator
import
autodoc
,
templatedoc
from
.tensor
import
assign
,
fill_constant
from
.tensor
import
assign
,
fill_constant
...
@@ -1532,7 +1532,7 @@ class DynamicRNN(object):
...
@@ -1532,7 +1532,7 @@ class DynamicRNN(object):
outputs
=
{
'Out'
:
[
x_reordered
]})
outputs
=
{
'Out'
:
[
x_reordered
]})
return
shrink_memory
(
x_reordered
,
self
.
step_idx
,
self
.
lod_rank_table
)
return
shrink_memory
(
x_reordered
,
self
.
step_idx
,
self
.
lod_rank_table
)
@
contextmanager
@
signature_safe_
contextmanager
def
block
(
self
):
def
block
(
self
):
"""
"""
The block for user to define operators in RNN. See the class docstring
The block for user to define operators in RNN. See the class docstring
...
...
python/paddle/fluid/layers/io.py
浏览文件 @
7e399b06
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
# limitations under the License.
# limitations under the License.
from
__future__
import
print_function
from
__future__
import
print_function
from
..wrapped_decorator
import
contextmanager
from
..wrapped_decorator
import
signature_safe_
contextmanager
import
multiprocessing
import
multiprocessing
import
os
import
os
import
six
import
six
...
@@ -1116,7 +1116,7 @@ class Preprocessor(object):
...
@@ -1116,7 +1116,7 @@ class Preprocessor(object):
def
_is_completed
(
self
):
def
_is_completed
(
self
):
return
self
.
sub_block
and
self
.
source_var_names
and
self
.
sink_var_names
return
self
.
sub_block
and
self
.
source_var_names
and
self
.
sink_var_names
@
contextmanager
@
signature_safe_
contextmanager
def
block
(
self
):
def
block
(
self
):
self
.
status
=
Preprocessor
.
IN_SUB_BLOCK
self
.
status
=
Preprocessor
.
IN_SUB_BLOCK
self
.
sub_block
=
self
.
main_prog
.
_create_block
()
self
.
sub_block
=
self
.
main_prog
.
_create_block
()
...
...
python/paddle/fluid/optimizer.py
浏览文件 @
7e399b06
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
from
__future__
import
print_function
from
__future__
import
print_function
from
collections
import
defaultdict
from
collections
import
defaultdict
from
.wrapped_decorator
import
contextmanager
from
.wrapped_decorator
import
signature_safe_
contextmanager
from
paddle.fluid.framework
import
Program
,
Variable
,
name_scope
,
default_main_program
from
paddle.fluid.framework
import
Program
,
Variable
,
name_scope
,
default_main_program
from
paddle.fluid.distribute_lookup_table
import
find_distributed_lookup_table
from
paddle.fluid.distribute_lookup_table
import
find_distributed_lookup_table
...
@@ -1610,7 +1610,7 @@ class ModelAverage(Optimizer):
...
@@ -1610,7 +1610,7 @@ class ModelAverage(Optimizer):
},
},
stop_gradient
=
True
)
stop_gradient
=
True
)
@
contextmanager
@
signature_safe_
contextmanager
def
apply
(
self
,
executor
,
need_restore
=
True
):
def
apply
(
self
,
executor
,
need_restore
=
True
):
"""Apply average values to parameters of current model.
"""Apply average values to parameters of current model.
"""
"""
...
...
python/paddle/fluid/profiler.py
浏览文件 @
7e399b06
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
from
__future__
import
print_function
from
__future__
import
print_function
from
.
import
core
from
.
import
core
from
.wrapped_decorator
import
contextmanager
from
.wrapped_decorator
import
signature_safe_
contextmanager
import
os
import
os
import
six
import
six
...
@@ -35,7 +35,7 @@ NVPROF_CONFIG = [
...
@@ -35,7 +35,7 @@ NVPROF_CONFIG = [
]
]
@
contextmanager
@
signature_safe_
contextmanager
def
cuda_profiler
(
output_file
,
output_mode
=
None
,
config
=
None
):
def
cuda_profiler
(
output_file
,
output_mode
=
None
,
config
=
None
):
"""The CUDA profiler.
"""The CUDA profiler.
This fuctions is used to profile CUDA program by CUDA runtime application
This fuctions is used to profile CUDA program by CUDA runtime application
...
@@ -217,7 +217,7 @@ def stop_profiler(sorted_key=None, profile_path='/tmp/profile'):
...
@@ -217,7 +217,7 @@ def stop_profiler(sorted_key=None, profile_path='/tmp/profile'):
core
.
disable_profiler
(
key_map
[
sorted_key
],
profile_path
)
core
.
disable_profiler
(
key_map
[
sorted_key
],
profile_path
)
@
contextmanager
@
signature_safe_
contextmanager
def
profiler
(
state
,
sorted_key
=
None
,
profile_path
=
'/tmp/profile'
):
def
profiler
(
state
,
sorted_key
=
None
,
profile_path
=
'/tmp/profile'
):
"""The profiler interface.
"""The profiler interface.
Different from cuda_profiler, this profiler can be used to profile both CPU
Different from cuda_profiler, this profiler can be used to profile both CPU
...
...
python/paddle/fluid/recordio_writer.py
浏览文件 @
7e399b06
...
@@ -15,14 +15,14 @@
...
@@ -15,14 +15,14 @@
from
__future__
import
print_function
from
__future__
import
print_function
import
os
import
os
from
.wrapped_decorator
import
contextmanager
from
.wrapped_decorator
import
signature_safe_
contextmanager
from
.
import
core
from
.
import
core
__all__
=
[
__all__
=
[
'convert_reader_to_recordio_file'
,
'convert_reader_to_recordio_files'
'convert_reader_to_recordio_file'
,
'convert_reader_to_recordio_files'
]
]
@
contextmanager
@
signature_safe_
contextmanager
def
create_recordio_writer
(
filename
,
def
create_recordio_writer
(
filename
,
compressor
=
core
.
RecordIOWriter
.
Compressor
.
Snappy
,
compressor
=
core
.
RecordIOWriter
.
Compressor
.
Snappy
,
max_num_records
=
1000
):
max_num_records
=
1000
):
...
...
python/paddle/fluid/unique_name.py
浏览文件 @
7e399b06
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
from
__future__
import
print_function
from
__future__
import
print_function
import
collections
import
collections
from
.wrapped_decorator
import
contextmanager
from
.wrapped_decorator
import
signature_safe_
contextmanager
import
six
import
six
import
sys
import
sys
...
@@ -68,7 +68,7 @@ def switch(new_generator=None):
...
@@ -68,7 +68,7 @@ def switch(new_generator=None):
return
old
return
old
@
contextmanager
@
signature_safe_
contextmanager
def
guard
(
new_generator
=
None
):
def
guard
(
new_generator
=
None
):
if
isinstance
(
new_generator
,
six
.
string_types
):
if
isinstance
(
new_generator
,
six
.
string_types
):
new_generator
=
UniqueNameGenerator
(
new_generator
)
new_generator
=
UniqueNameGenerator
(
new_generator
)
...
...
python/paddle/fluid/wrapped_decorator.py
浏览文件 @
7e399b06
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
import
decorator
import
decorator
import
contextlib
import
contextlib
__all__
=
[
'wrap_decorator'
,
'contextmanager'
]
__all__
=
[
'wrap_decorator'
,
'
signature_safe_
contextmanager'
]
def
wrap_decorator
(
decorator_func
):
def
wrap_decorator
(
decorator_func
):
...
@@ -27,4 +27,4 @@ def wrap_decorator(decorator_func):
...
@@ -27,4 +27,4 @@ def wrap_decorator(decorator_func):
return
__impl__
return
__impl__
contextmanager
=
wrap_decorator
(
contextlib
.
contextmanager
)
signature_safe_
contextmanager
=
wrap_decorator
(
contextlib
.
contextmanager
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录