Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
df9c13a8
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看板
未验证
提交
df9c13a8
编写于
1月 13, 2018
作者:
C
Cao Ying
提交者:
GitHub
1月 13, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7485 from lcy-seso/wrapper_for_elementwise_math_op
add wrapper for element-wise math operator.
上级
db65f497
8ac744f3
变更
16
显示空白变更内容
内联
并排
Showing
16 changed file
with
304 addition
and
65 deletion
+304
-65
doc/api/v2/fluid/layers.rst
doc/api/v2/fluid/layers.rst
+129
-0
python/paddle/v2/fluid/__init__.py
python/paddle/v2/fluid/__init__.py
+16
-3
python/paddle/v2/fluid/backward.py
python/paddle/v2/fluid/backward.py
+4
-1
python/paddle/v2/fluid/clip.py
python/paddle/v2/fluid/clip.py
+3
-1
python/paddle/v2/fluid/default_scope_funcs.py
python/paddle/v2/fluid/default_scope_funcs.py
+15
-11
python/paddle/v2/fluid/evaluator.py
python/paddle/v2/fluid/evaluator.py
+19
-16
python/paddle/v2/fluid/framework.py
python/paddle/v2/fluid/framework.py
+9
-3
python/paddle/v2/fluid/initializer.py
python/paddle/v2/fluid/initializer.py
+6
-1
python/paddle/v2/fluid/io.py
python/paddle/v2/fluid/io.py
+9
-3
python/paddle/v2/fluid/layers/nn.py
python/paddle/v2/fluid/layers/nn.py
+33
-12
python/paddle/v2/fluid/layers/ops.py
python/paddle/v2/fluid/layers/ops.py
+28
-1
python/paddle/v2/fluid/layers/tensor.py
python/paddle/v2/fluid/layers/tensor.py
+10
-2
python/paddle/v2/fluid/memory_optimization_transpiler.py
python/paddle/v2/fluid/memory_optimization_transpiler.py
+4
-2
python/paddle/v2/fluid/nets.py
python/paddle/v2/fluid/nets.py
+4
-1
python/paddle/v2/fluid/registry.py
python/paddle/v2/fluid/registry.py
+10
-7
python/paddle/v2/fluid/regularizer.py
python/paddle/v2/fluid/regularizer.py
+5
-1
未找到文件。
doc/api/v2/fluid/layers.rst
浏览文件 @
df9c13a8
...
...
@@ -358,3 +358,132 @@ reduce_min
.. autofunction:: paddle.v2.fluid.layers.reduce_min
:noindex:
logsigmoid
----------
.. autofunction:: paddle.v2.fluid.layers.logsigmoid
:noindex:
exp
---
.. autofunction:: paddle.v2.fluid.layers.exp
:noindex:
relu
----
.. autofunction:: paddle.v2.fluid.layers.relu
:noindex:
tanh
----
.. autofunction:: paddle.v2.fluid.layers.tanh
:noindex:
tanh_shrink
-----------
.. autofunction:: paddle.v2.fluid.layers.tanh_shrink
:noindex:
softshrink
----------
.. autofunction:: paddle.v2.fluid.layers.softshrink
:noindex:
sqrt
----
.. autofunction:: paddle.v2.fluid.layers.sqrt
:noindex:
abs
----
.. autofunction:: paddle.v2.fluid.layers.abs
:noindex:
ceil
----
.. autofunction:: paddle.v2.fluid.layers.ceil
:noindex:
floor
-----
.. autofunction:: paddle.v2.fluid.layers.floor
:noindex:
round
-----
.. autofunction:: paddle.v2.fluid.layers.round
:noindex:
reciprocal
----------
.. autofunction:: paddle.v2.fluid.layers.reciprocal
:noindex:
log
---
.. autofunction:: paddle.v2.fluid.layers.log
:noindex:
square
------
.. autofunction:: paddle.v2.fluid.layers.square
:noindex:
softplus
--------
.. autofunction:: paddle.v2.fluid.layers.softplus
:noindex:
softsign
---------
.. autofunction:: paddle.v2.fluid.layers.softsign
:noindex:
brelu
-----
.. autofunction:: paddle.v2.fluid.layers.brelu
:noindex:
leaky_relu
----------
.. autofunction:: paddle.v2.fluid.layers.leaky_relu
:noindex:
soft_relu
---------
.. autofunction:: paddle.v2.fluid.layers.soft_relu
:noindex:
elu
----
.. autofunction:: paddle.v2.fluid.layers.elu
:noindex:
relu6
-----
.. autofunction:: paddle.v2.fluid.layers.relu6
:noindex:
pow
----
.. autofunction:: paddle.v2.fluid.layers.pow
:noindex:
hard_shrink
-----------
.. autofunction:: paddle.v2.fluid.layers.hard_shrink
:noindex:
thresholded_relu
----------------
.. autofunction:: paddle.v2.fluid.layers.thresholded_relu
:noindex:
hard_sigmoid
-------------
.. autofunction:: paddle.v2.fluid.layers.hard_sigmoid
:noindex:
swish
------
.. autofunction:: paddle.v2.fluid.layers.swish
:noindex:
python/paddle/v2/fluid/__init__.py
浏览文件 @
df9c13a8
...
...
@@ -23,9 +23,22 @@ from memory_optimization_transpiler import memory_optimize
Tensor
=
LoDTensor
__all__
=
framework
.
__all__
+
executor
.
__all__
+
[
'io'
,
'initializer'
,
'layers'
,
'nets'
,
'optimizer'
,
'backward'
,
'regularizer'
,
'LoDTensor'
,
'CPUPlace'
,
'CUDAPlace'
,
'Tensor'
,
'ParamAttr'
'DataFeeder'
,
'clip'
,
'DistributeTranspiler'
,
'memory_optimize'
'io'
,
'initializer'
,
'layers'
,
'nets'
,
'optimizer'
,
'backward'
,
'regularizer'
,
'LoDTensor'
,
'CPUPlace'
,
'CUDAPlace'
,
'Tensor'
,
'ParamAttr'
'DataFeeder'
,
'clip'
,
'DistributeTranspiler'
,
'memory_optimize'
,
]
...
...
python/paddle/v2/fluid/backward.py
浏览文件 @
df9c13a8
...
...
@@ -3,7 +3,10 @@ from . import core
import
collections
import
copy
__all__
=
[
'append_backward'
,
'calc_gradient'
]
__all__
=
[
'append_backward'
,
'calc_gradient'
,
]
def
_rename_arg_
(
op_descs
,
old_name
,
new_name
,
begin_idx
=
None
,
end_idx
=
None
):
...
...
python/paddle/v2/fluid/clip.py
浏览文件 @
df9c13a8
...
...
@@ -3,7 +3,9 @@ import layers
from
.
import
core
__all__
=
[
'GradientClipByValue'
,
'append_gradient_clip_ops'
,
'error_clip_callback'
'GradientClipByValue'
,
'append_gradient_clip_ops'
,
'error_clip_callback'
,
]
...
...
python/paddle/v2/fluid/default_scope_funcs.py
浏览文件 @
df9c13a8
...
...
@@ -19,8 +19,12 @@ import threading
__tl_scope__
=
threading
.
local
()
__all__
=
[
'get_cur_scope'
,
'enter_local_scope'
,
'leave_local_scope'
,
'var'
,
'find_var'
,
'scoped_function'
'get_cur_scope'
,
'enter_local_scope'
,
'leave_local_scope'
,
'var'
,
'find_var'
,
'scoped_function'
,
]
...
...
python/paddle/v2/fluid/evaluator.py
浏览文件 @
df9c13a8
...
...
@@ -4,7 +4,10 @@ import layers
from
framework
import
Program
,
unique_name
,
Variable
,
program_guard
from
layer_helper
import
LayerHelper
__all__
=
[
'Accuracy'
,
'ChunkEvaluator'
]
__all__
=
[
'Accuracy'
,
'ChunkEvaluator'
,
]
def
_clone_var_
(
block
,
var
):
...
...
python/paddle/v2/fluid/framework.py
浏览文件 @
df9c13a8
...
...
@@ -7,9 +7,15 @@ import proto.framework_pb2 as framework_pb2
from
.
import
core
__all__
=
[
'Block'
,
'Variable'
,
'Program'
,
'Operator'
,
'default_startup_program'
,
'default_main_program'
,
'program_guard'
,
'switch_startup_program'
,
'switch_main_program'
'Block'
,
'Variable'
,
'Program'
,
'Operator'
,
'default_startup_program'
,
'default_main_program'
,
'program_guard'
,
'switch_startup_program'
,
'switch_main_program'
,
]
EMPTY_VAR_NAME
=
core
.
kEmptyVarName
()
...
...
python/paddle/v2/fluid/initializer.py
浏览文件 @
df9c13a8
import
framework
import
numpy
as
np
__all__
=
[
'Constant'
,
'Uniform'
,
'Normal'
,
'Xavier'
]
__all__
=
[
'Constant'
,
'Uniform'
,
'Normal'
,
'Xavier'
,
]
class
Initializer
(
object
):
...
...
python/paddle/v2/fluid/io.py
浏览文件 @
df9c13a8
...
...
@@ -4,9 +4,15 @@ import cPickle as pickle
from
paddle.v2.fluid.framework
import
Program
,
Parameter
,
default_main_program
,
Variable
__all__
=
[
'save_vars'
,
'save_params'
,
'save_persistables'
,
'load_vars'
,
'load_params'
,
'load_persistables'
,
"save_inference_model"
,
"load_inference_model"
,
"get_inference_program"
'save_vars'
,
'save_params'
,
'save_persistables'
,
'load_vars'
,
'load_params'
,
'load_persistables'
,
'save_inference_model'
,
'load_inference_model'
,
'get_inference_program'
,
]
...
...
python/paddle/v2/fluid/layers/nn.py
浏览文件 @
df9c13a8
...
...
@@ -9,12 +9,33 @@ from ..param_attr import ParamAttr
from
tensor
import
concat
__all__
=
[
'fc'
,
'embedding'
,
'dynamic_lstm'
,
'gru_unit'
,
'linear_chain_crf'
,
'crf_decoding'
,
'cos_sim'
,
'cross_entropy'
,
'square_error_cost'
,
'accuracy'
,
'chunk_eval'
,
'sequence_conv'
,
'conv2d'
,
'sequence_pool'
,
'pool2d'
,
'batch_norm'
,
'beam_search_decode'
,
'conv2d_transpose'
,
'sequence_expand'
,
'lstm_unit'
,
'reduce_sum'
,
'reduce_mean'
,
'reduce_max'
,
'reduce_min'
,
'sequence_first_step'
,
'sequence_last_step'
,
'dropout'
'fc'
,
'embedding'
,
'dynamic_lstm'
,
'gru_unit'
,
'linear_chain_crf'
,
'crf_decoding'
,
'cos_sim'
,
'cross_entropy'
,
'square_error_cost'
,
'accuracy'
,
'chunk_eval'
,
'sequence_conv'
,
'conv2d'
,
'sequence_pool'
,
'pool2d'
,
'batch_norm'
,
'beam_search_decode'
,
'conv2d_transpose'
,
'sequence_expand'
,
'lstm_unit'
,
'reduce_sum'
,
'reduce_mean'
,
'reduce_max'
,
'reduce_min'
,
'sequence_first_step'
,
'sequence_last_step'
,
'dropout'
,
]
...
...
python/paddle/v2/fluid/layers/ops.py
浏览文件 @
df9c13a8
from
..registry
import
register_layer
__activations__
=
[
'abs'
,
'tanh'
,
'sigmoid'
,
'relu'
,
'sqrt'
,
'ceil'
,
'floor'
,
'log'
,
'round'
'sigmoid'
,
'logsigmoid'
,
'exp'
,
'relu'
,
'tanh'
,
'tanh_shrink'
,
'softshrink'
,
'sqrt'
,
'abs'
,
'ceil'
,
'floor'
,
'round'
,
'reciprocal'
,
'log'
,
'square'
,
'softplus'
,
'softsign'
,
'brelu'
,
'leaky_relu'
,
'soft_relu'
,
'elu'
,
'relu6'
,
'pow'
,
'stanh'
,
'hard_shrink'
,
'thresholded_relu'
,
'hard_sigmoid'
,
'swish'
,
]
__all__
=
[
...
...
python/paddle/v2/fluid/layers/tensor.py
浏览文件 @
df9c13a8
...
...
@@ -6,8 +6,16 @@ from ..core import DataType
import
numpy
__all__
=
[
'create_tensor'
,
'create_parameter'
,
'cast'
,
'concat'
,
'sums'
,
'assign'
,
'fill_constant_batch_size_like'
,
'fill_constant'
,
'ones'
,
'zeros'
'create_tensor'
,
'create_parameter'
,
'cast'
,
'concat'
,
'sums'
,
'assign'
,
'fill_constant_batch_size_like'
,
'fill_constant'
,
'ones'
,
'zeros'
,
]
...
...
python/paddle/v2/fluid/memory_optimization_transpiler.py
浏览文件 @
df9c13a8
...
...
@@ -121,8 +121,10 @@ class ControlFlowGraph(object):
# and dtype_to_size[cache_dtype]
if
x_dtype
==
cache_dtype
:
print
(
"Hit Cache !!!! cache pool index is %d, var name is %s, cached var name is %s, var shape is %s "
%
(
"Hit Cache !!!! cache pool index "
"is %d, var name is %s, "
"cached var name is %s, "
"var shape is %s "
)
%
(
index
,
x
,
cache_var
,
str
(
cache_shape
)))
self
.
pool
.
pop
(
index
)
_rename_arg_
(
...
...
python/paddle/v2/fluid/nets.py
浏览文件 @
df9c13a8
import
layers
__all__
=
[
"simple_img_conv_pool"
,
"sequence_conv_pool"
]
__all__
=
[
"simple_img_conv_pool"
,
"sequence_conv_pool"
,
]
def
simple_img_conv_pool
(
input
,
...
...
python/paddle/v2/fluid/registry.py
浏览文件 @
df9c13a8
...
...
@@ -8,7 +8,11 @@ import proto.framework_pb2 as framework_pb2
from
framework
import
OpProtoHolder
,
Variable
,
Program
,
Operator
from
paddle.v2.fluid.layer_helper
import
LayerHelper
,
unique_name
__all__
=
[
'deprecated'
,
'register_layer'
,
'autodoc'
]
__all__
=
[
'deprecated'
,
'register_layer'
,
'autodoc'
,
]
def
_convert_
(
name
):
...
...
@@ -80,11 +84,10 @@ def _generate_doc_string_(op_proto):
def
register_layer
(
op_type
):
"""
Register an Python layer for an Operator
"""Register the Python layer for an Operator.
Args:
op_type: The name of the operator to be created
op_type: The name of the operator to be created
.
This function takes in the operator type (sigmoid, mean , average etc) and
creates the operator functionality.
...
...
@@ -98,16 +101,16 @@ def register_layer(op_type):
if
len
(
not_intermediate_outputs
)
!=
1
:
raise
ValueError
(
"Only one non intermediate output operator can be"
,
"automatically generated"
)
"automatically generated
.
"
)
if
not_intermediate_outputs
[
0
].
duplicable
:
raise
ValueError
(
"Only non duplicable op can be automatically generated"
)
"Only non duplicable op can be automatically generated
.
"
)
for
output
in
intermediate_outputs
:
if
output
.
duplicable
:
raise
ValueError
(
"The op can be automatically generated only when "
,
"all intermediate ops are not duplicable"
)
"all intermediate ops are not duplicable
.
"
)
o_name
=
not_intermediate_outputs
[
0
].
name
intermediate_output_names
=
[
output
.
name
for
output
in
intermediate_outputs
]
...
...
python/paddle/v2/fluid/regularizer.py
浏览文件 @
df9c13a8
import
framework
__all__
=
[
'append_regularization_ops'
,
'L1Decay'
,
'L2Decay'
]
__all__
=
[
'append_regularization_ops'
,
'L1Decay'
,
'L2Decay'
,
]
def
append_regularization_ops
(
parameters_and_grads
,
regularization
=
None
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录