Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
ce6394ed
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看板
提交
ce6394ed
编写于
6月 13, 2018
作者:
Y
yuyang18
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish example
上级
b9843abb
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
48 addition
and
22 deletion
+48
-22
paddle/fluid/operators/row_conv_op.cc
paddle/fluid/operators/row_conv_op.cc
+1
-1
paddle/fluid/operators/uniform_random_op.cc
paddle/fluid/operators/uniform_random_op.cc
+0
-2
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+20
-10
python/paddle/fluid/layers/ops.py
python/paddle/fluid/layers/ops.py
+20
-1
python/paddle/fluid/layers/tensor.py
python/paddle/fluid/layers/tensor.py
+7
-8
未找到文件。
paddle/fluid/operators/row_conv_op.cc
浏览文件 @
ce6394ed
...
@@ -114,7 +114,7 @@ and a filter ($W$) of size $context \times d$,
...
@@ -114,7 +114,7 @@ and a filter ($W$) of size $context \times d$,
the output sequence is convolved as:
the output sequence is convolved as:
$$
$$
out_{i, :} = \
sum_{j=i}^{i + context} in_{j,:} \
dot W_{i-j, :}
out_{i, :} = \
\sum_{j=i}^{i + context} in_{j,:} \\c
dot W_{i-j, :}
$$
$$
In the above equation:
In the above equation:
...
...
paddle/fluid/operators/uniform_random_op.cc
浏览文件 @
ce6394ed
...
@@ -88,8 +88,6 @@ class UniformRandomOpMaker : public framework::OpProtoAndCheckerMaker {
...
@@ -88,8 +88,6 @@ class UniformRandomOpMaker : public framework::OpProtoAndCheckerMaker {
void
Make
()
override
{
void
Make
()
override
{
AddOutput
(
"Out"
,
"The output tensor of uniform random op"
);
AddOutput
(
"Out"
,
"The output tensor of uniform random op"
);
AddComment
(
R"DOC(
AddComment
(
R"DOC(
Uniform random operator.
This operator initializes a tensor with random values sampled from a
This operator initializes a tensor with random values sampled from a
uniform distribution. The random result is in set [min, max].
uniform distribution. The random result is in set [min, max].
...
...
python/paddle/fluid/layers/nn.py
浏览文件 @
ce6394ed
...
@@ -1718,10 +1718,14 @@ def layer_norm(input,
...
@@ -1718,10 +1718,14 @@ def layer_norm(input,
h & = f(
\\
frac{g}{
\\
sigma}(a -
\\
mu) + b)
h & = f(
\\
frac{g}{
\\
sigma}(a -
\\
mu) + b)
>>> import paddle.fluid as fluid
* :math:`a`: the vector representation of the summed inputs to the neurons
>>> data = fluid.layers.data(name='data', shape=[3, 32, 32],
in that layer.
>>> dtype='float32')
>>> x = fluid.layers.layer_norm(input=data, begin_norm_axis=1)
* :math:`H`: the number of hidden units in a layers
* :math:`g`: the trainable scale parameter.
* :math:`b`: the trainable bias parameter.
Args:
Args:
input(Variable): The input tensor variable.
input(Variable): The input tensor variable.
...
@@ -1742,6 +1746,12 @@ def layer_norm(input,
...
@@ -1742,6 +1746,12 @@ def layer_norm(input,
Returns:
Returns:
${y_comment}
${y_comment}
Examples:
>>> data = fluid.layers.data(name='data', shape=[3, 32, 32],
>>> dtype='float32')
>>> x = fluid.layers.layer_norm(input=data, begin_norm_axis=1)
"""
"""
helper
=
LayerHelper
(
'layer_norm'
,
**
locals
())
helper
=
LayerHelper
(
'layer_norm'
,
**
locals
())
dtype
=
helper
.
input_dtype
()
dtype
=
helper
.
input_dtype
()
...
@@ -3262,12 +3272,6 @@ def row_conv(input, future_context_size, param_attr=None, act=None):
...
@@ -3262,12 +3272,6 @@ def row_conv(input, future_context_size, param_attr=None, act=None):
"""
"""
${comment}
${comment}
>>> import paddle.fluid as fluid
>>> x = fluid.layers.data(name='x', shape=[16],
>>> dtype='float32', lod_level=1)
>>> out = fluid.layers.row_conv(input=x, future_context_size=2)
Args:
Args:
input (${x_type}): ${x_comment}.
input (${x_type}): ${x_comment}.
future_context_size (int): Future context size. Please note, the shape
future_context_size (int): Future context size. Please note, the shape
...
@@ -3278,6 +3282,12 @@ def row_conv(input, future_context_size, param_attr=None, act=None):
...
@@ -3278,6 +3282,12 @@ def row_conv(input, future_context_size, param_attr=None, act=None):
Returns:
Returns:
${out_comment}.
${out_comment}.
Examples:
>>> import paddle.fluid as fluid
>>> x = fluid.layers.data(name='x', shape=[16],
>>> dtype='float32', lod_level=1)
>>> out = fluid.layers.row_conv(input=x, future_context_size=2)
"""
"""
helper
=
LayerHelper
(
'row_conv'
,
**
locals
())
helper
=
LayerHelper
(
'row_conv'
,
**
locals
())
dtype
=
helper
.
input_dtype
()
dtype
=
helper
.
input_dtype
()
...
...
python/paddle/fluid/layers/ops.py
浏览文件 @
ce6394ed
...
@@ -64,7 +64,6 @@ __all__ = [
...
@@ -64,7 +64,6 @@ __all__ = [
'logical_or'
,
'logical_or'
,
'logical_xor'
,
'logical_xor'
,
'logical_not'
,
'logical_not'
,
'uniform_random'
,
'uniform_random_batch_size_like'
,
'uniform_random_batch_size_like'
,
'gaussian_random'
,
'gaussian_random'
,
'gaussian_random_batch_size_like'
,
'gaussian_random_batch_size_like'
,
...
@@ -79,3 +78,23 @@ __all__ = [
...
@@ -79,3 +78,23 @@ __all__ = [
for
_OP
in
set
(
__all__
):
for
_OP
in
set
(
__all__
):
globals
()[
_OP
]
=
generate_layer_fn
(
_OP
)
globals
()[
_OP
]
=
generate_layer_fn
(
_OP
)
__all__
+=
[
"uniform_random"
]
_uniform_random_
=
generate_layer_fn
(
'uniform_random'
)
def
uniform_random
(
shape
,
dtype
=
None
,
min
=
None
,
max
=
None
,
seed
=
None
):
kwargs
=
dict
()
for
name
in
locals
():
val
=
locals
()[
name
]
if
val
is
not
None
:
kwargs
[
name
]
=
val
return
_uniform_random_
(
**
kwargs
)
uniform_random
.
__doc__
=
_uniform_random_
.
__doc__
+
"
\n
"
\
+
"""
Examples:
>>> result = fluid.layers.uniform_random(shape=[32, 784])
"""
python/paddle/fluid/layers/tensor.py
浏览文件 @
ce6394ed
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
#
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# Unless
f
required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# distributed under the License is distributed on an "AS IS" BASIS,
# 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
...
@@ -57,12 +57,6 @@ def create_parameter(shape,
...
@@ -57,12 +57,6 @@ def create_parameter(shape,
NOTE: this is a very low-level API. This API is useful when you create
NOTE: this is a very low-level API. This API is useful when you create
operator by your self. instead of using layers.
operator by your self. instead of using layers.
>>> import paddle.fluid as fluid
>>> W = fluid.layers.create_parameter(shape=[784, 200], dtype='float32')
>>> data = fluid.layers.data(name="img", shape=[64, 784],
>>> append_batch_size=False)
>>> hidden = fluid.layers.matmul(x=data, y=W)
Args:
Args:
shape(list[int]): shape of the parameter
shape(list[int]): shape of the parameter
dtype(string): element type of the parameter
dtype(string): element type of the parameter
...
@@ -74,7 +68,12 @@ def create_parameter(shape,
...
@@ -74,7 +68,12 @@ def create_parameter(shape,
default_initializer(Initializer): initializer for the parameter
default_initializer(Initializer): initializer for the parameter
Returns:
Returns:
the created parameter
the created parameter.
Examples:
>>> W = fluid.layers.create_parameter(shape=[784, 200], dtype='float32')
>>> data = fluid.layers.data(name="img", shape=[64, 784], append_batch_size=False)
>>> hidden = fluid.layers.matmul(x=data, y=W)
"""
"""
helper
=
LayerHelper
(
"create_parameter"
,
**
locals
())
helper
=
LayerHelper
(
"create_parameter"
,
**
locals
())
if
attr
is
None
:
if
attr
is
None
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录