Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
FluidDoc
提交
dba693f3
F
FluidDoc
项目概览
PaddlePaddle
/
FluidDoc
通知
10
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
23
列表
看板
标记
里程碑
合并请求
111
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
FluidDoc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
23
Issue
23
列表
看板
标记
里程碑
合并请求
111
合并请求
111
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
dba693f3
编写于
9月 26, 2019
作者:
H
hong19860320
提交者:
GitHub
9月 26, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update cn doc for hard_sigmoid, increment and reverse op (#1382)
上级
eaab35cc
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
28 addition
and
61 deletion
+28
-61
doc/fluid/api_cn/layers_cn/hard_sigmoid_cn.rst
doc/fluid/api_cn/layers_cn/hard_sigmoid_cn.rst
+11
-19
doc/fluid/api_cn/layers_cn/increment_cn.rst
doc/fluid/api_cn/layers_cn/increment_cn.rst
+8
-24
doc/fluid/api_cn/layers_cn/reverse_cn.rst
doc/fluid/api_cn/layers_cn/reverse_cn.rst
+9
-18
未找到文件。
doc/fluid/api_cn/layers_cn/hard_sigmoid_cn.rst
浏览文件 @
dba693f3
...
...
@@ -5,34 +5,26 @@ hard_sigmoid
.. py:function:: paddle.fluid.layers.hard_sigmoid(x, slope=0.2, offset=0.5, name=None)
HardSigmoid激活算子。
sigmoid的分段线性逼近(https://arxiv.org/abs/1603.00391),比sigmoid快得多。
sigmoid的分段线性逼近激活函数,速度比sigmoid快,详细解释参见 https://arxiv.org/abs/1603.00391。
.. math::
\\out=\max(0,\min(1,slope∗x+shift))\\
斜率是正数。偏移量可正可负的。斜率和位移的默认值是根据上面的参考设置的。建议使用默认值。
\\out=\max(0,\min(1,slope∗x+offset))\\
参数:
- **x** (Variable) -
HardSigmoid operator的输入
- **slope** (
FLOAT|0.2) -斜率
- **offset** (
FLOAT|0.5) - 偏移量
- **name** (str
|None) - 这个层的名称(可选)。如果设置为None,该层将被自动命名
。
- **x** (Variable) -
该OP的输入为多维Tensor。数据类型必须为float32或float64。
- **slope** (
float,可选) - 斜率。值必须为正数,默认值为0.2。
- **offset** (
float,可选) - 偏移量。默认值为0.5。
- **name** (str
, 可选) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name`,默认值为None
。
返回:激活后的Tensor,形状、数据类型和 ``x`` 一致。
**代码示例:**
返回类型:Variable
**代码示例:**
.. code-block:: python
import paddle.fluid as fluid
x = fluid.layers.data(name="x", shape=[3,10,32,32], dtype="float32")
y = fluid.layers.hard_sigmoid(x, slope=0.3, offset=0.8)
data = fluid.layers.fill_constant(shape=[3, 2], value=0.5, dtype='float32') # [[0.5, 0.5], [0.5, 0.5], [0.5, 0.5]]
result = fluid.layers.hard_sigmoid(data) # [[0.6, 0.6], [0.6, 0.6], [0.6, 0.6]]
doc/fluid/api_cn/layers_cn/increment_cn.rst
浏览文件 @
dba693f3
...
...
@@ -5,37 +5,21 @@ increment
.. py:function:: paddle.fluid.layers.increment(x, value=1.0, in_place=True)
该函数为输入 ``x`` 增加 ``value`` 大小, ``value`` 即函数中待传入的参数。该函数默认直接在原变量 ``x`` 上进行运算。
.. note::
``x`` 中元素个数必须为1
使输入Tensor ``x`` 的数据累加 ``value`` , 该OP通常用于循环次数的计数。
参数:
- **x** (Variable
|list) – 含有输入值的张量(tensor)
- **value** (float
) – 需要增加在 ``x`` 变量上的值
- **in_place** (bool
) – 判断是否在x变量本身执行操作,True原地执行,False时,返回增加后的副本
- **x** (Variable
) – 元素个数为1的Tensor,数据类型必须为float32,float64,int32,int64。
- **value** (float
,可选) – 需要增加的值,默认为1.0。
- **in_place** (bool
,可选) – 输出Tensor是否和输入Tensor ``x`` 复用同一块内存,默认为True。
返回:
每个元素增加后的对象
返回:
累加计算后的Tensor,形状、数据类型和 ``x`` 一致。
返回类型:
变量(variable)
返回类型:
Variable
**代码示例**
.. code-block:: python
import paddle.fluid as fluid
data = fluid.layers.data(name='data', shape=[1], dtype='float32',
append_batch_size=False)
data = fluid.layers.increment(x=data, value=3.0, in_place=True)
counter = fluid.layers.zeros(shape=[1], dtype='float32') # [0.]
fluid.layers.increment(counter) # [1.]
doc/fluid/api_cn/layers_cn/reverse_cn.rst
浏览文件 @
dba693f3
...
...
@@ -7,31 +7,22 @@ reverse
**reverse**
该
功能将给定轴上的输入‘x’逆序
该
OP对输入Tensor ``x`` 在指定轴 ``axis`` 上进行数据的逆序操作。
参数:
- **x** (Variable)
-预逆序的输入
- **axis** (int|tuple|list) -
元素逆序排列的轴。如果该参数是一个元组或列表,则对该参数中
每个元素值所指定的轴上进行逆序运算。
- **x** (Variable)
- 多维Tensor,类型必须为int32,int64,float32,float64。
- **axis** (int|tuple|list) -
指定逆序运算的轴,取值范围是[-R, R),R是输入 ``x`` 的Rank, ``axis`` 为负时与 ``axis`` +R 等价。如果 ``axis`` 是一个元组或列表,则在``axis``
每个元素值所指定的轴上进行逆序运算。
返回:逆序
的张量
返回:逆序
后的Tensor,形状、数据类型和 ``x`` 一致。
返回类型:
变量(Variable)
返回类型:
Variable
**代码示例**:
.. code-block:: python
import paddle.fluid as fluid
data = fluid.layers.data(name="data", shape=[4, 8], dtype="float32")
out = fluid.layers.reverse(x=data, axis=0)
# or:
out = fluid.layers.reverse(x=data, axis=[0,1])
import numpy as np
data = fluid.layers.assign(np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8]], dtype='float32')) # [[0., 1., 2.], [3., 4., 5.], [6., 7., 8.]]
result1 = fluid.layers.reverse(data, 0) # [[6., 7., 8.], [3., 4., 5.], [0., 1., 2.]]
result2 = fluid.layers.reverse(data, [0, 1]) # [[8., 7., 6.], [5., 4., 3.], [2., 1., 0.]]
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录