Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
FluidDoc
提交
24e41915
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看板
未验证
提交
24e41915
编写于
1月 07, 2020
作者:
F
Feiyu Chan
提交者:
GitHub
1月 07, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add doc for erf op (#1675)
* add doc for erf op in Chinese. * update doc for erf op to add float16 support.
上级
37b4111a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
69 addition
and
0 deletion
+69
-0
doc/fluid/api_cn/layers_cn/erf_cn.rst
doc/fluid/api_cn/layers_cn/erf_cn.rst
+69
-0
未找到文件。
doc/fluid/api_cn/layers_cn/erf_cn.rst
0 → 100644
浏览文件 @
24e41915
.. _cn_api_fluid_layers_erf:
erf
-------------------------------
.. py:function:: paddle.fluid.layers.erf(x)
逐元素计算 Erf 激活函数。更多细节请参考 `Error function <https://en.wikipedia.org/wiki/Error_function>`_ 。
.. math::
out = \frac{2}{\sqrt{\pi}} \int_{0}^{x}e^{- \eta^{2}}d\eta
参数:
- **x** (Variable) - Erf Op 的输入,多维 Tensor 或 LoDTensor,数据类型为 float16, float32 或 float64。
返回:
- 多维 Tensor 或 LoDTensor, 数据类型为 float16, float32 或 float64, 和输入 x 的数据类型相同,形状和输入 x 相同。
返回类型:
- Variable
**代码示例**:
.. code-block:: python
# declarative mode
import numpy as np
from paddle import fluid
x = fluid.data(name="x", shape=(-1, 3), dtype="float32")
y = fluid.layers.erf(x)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
start = fluid.default_startup_program()
main = fluid.default_main_program()
data = np.random.randn(2, 3).astype("float32")
exe.run(start)
y_np, = exe.run(main, feed={"x": data}, fetch_list=[y])
data
# array([[ 0.4643714 , -1.1509596 , 1.2538221 ],
# [ 0.34369683, 0.27478245, 1.1805398 ]], dtype=float32)
y_np
# array([[ 0.48863927, -0.8964121 , 0.9237998 ],
# [ 0.37307587, 0.30242872, 0.9049887 ]], dtype=float32)
.. code-block:: python
# imperative mode
import numpy as np
from paddle import fluid
import paddle.fluid.dygraph as dg
data = np.random.randn(2, 3).astype("float32")
place = fluid.CPUPlace()
with dg.guard(place) as g:
x = dg.to_variable(data)
y = fluid.layers.erf(x)
y_np = y.numpy()
data
# array([[ 0.4643714 , -1.1509596 , 1.2538221 ],
# [ 0.34369683, 0.27478245, 1.1805398 ]], dtype=float32)
y_np
# array([[ 0.48863927, -0.8964121 , 0.9237998 ],
# [ 0.37307587, 0.30242872, 0.9049887 ]], dtype=float32)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录