Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
hapi
提交
f1b6a68b
H
hapi
项目概览
PaddlePaddle
/
hapi
通知
11
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
7
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hapi
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
7
合并请求
7
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f1b6a68b
编写于
5月 13, 2020
作者:
G
guosheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add some apis in hapi.text into example code white list.
test=develop
上级
a13654b9
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
28 addition
and
1 deletion
+28
-1
hapi/text/text.py
hapi/text/text.py
+28
-1
未找到文件。
hapi/text/text.py
浏览文件 @
f1b6a68b
...
@@ -222,6 +222,19 @@ class BasicLSTMCell(RNNCell):
...
@@ -222,6 +222,19 @@ class BasicLSTMCell(RNNCell):
forget_bias(float, optional): forget bias used when computing forget gate.
forget_bias(float, optional): forget bias used when computing forget gate.
Default 1.0
Default 1.0
dtype(string, optional): The data type used in this cell. Default float32.
dtype(string, optional): The data type used in this cell. Default float32.
Examples:
.. code-block:: python
import paddle
import paddle.fluid as fluid
from paddle.incubate.hapi.text import BasicLSTMCell, RNN
inputs = paddle.rand((2, 4, 32))
cell = BasicLSTMCell(input_size=32, hidden_size=64)
rnn = RNN(cell=cell)
outputs, _ = rnn(inputs) # [2, 4, 64]
"""
"""
def
__init__
(
self
,
def
__init__
(
self
,
...
@@ -339,6 +352,19 @@ class BasicGRUCell(RNNCell):
...
@@ -339,6 +352,19 @@ class BasicGRUCell(RNNCell):
GRU, that is :math:`act_c` in the formula. Default: None,
GRU, that is :math:`act_c` in the formula. Default: None,
representing for 'fluid.layers.tanh'.
representing for 'fluid.layers.tanh'.
dtype(string, optional): The data type used in this cell. Default float32.
dtype(string, optional): The data type used in this cell. Default float32.
Examples:
.. code-block:: python
import paddle
import paddle.fluid as fluid
from paddle.incubate.hapi.text import BasicGRUCell, RNN
inputs = paddle.rand((2, 4, 32))
cell = BasicGRUCell(input_size=32, hidden_size=64)
rnn = RNN(cell=cell)
outputs, _ = rnn(inputs) # [2, 4, 64]
"""
"""
def
__init__
(
self
,
def
__init__
(
self
,
...
@@ -1787,7 +1813,7 @@ class DynamicDecode(Layer):
...
@@ -1787,7 +1813,7 @@ class DynamicDecode(Layer):
trg_embeder = fluid.dygraph.Embedding(size=[vocab_size, d_model])
trg_embeder = fluid.dygraph.Embedding(size=[vocab_size, d_model])
output_layer = fluid.dygraph.Linear(d_model, vocab_size)
output_layer = fluid.dygraph.Linear(d_model, vocab_size)
cell = StackedLSTMCell(input_size=d_model, hidden_size=d_model)
cell = StackedLSTMCell(input_size=d_model, hidden_size=d_model)
decoder = BeamSearchDecoder(
decoder_
cell,
decoder = BeamSearchDecoder(cell,
start_token=0,
start_token=0,
end_token=1,
end_token=1,
beam_size=4,
beam_size=4,
...
@@ -3665,6 +3691,7 @@ class CRFDecoding(Layer):
...
@@ -3665,6 +3691,7 @@ class CRFDecoding(Layer):
.. code-block:: python
.. code-block:: python
import numpy as np
import paddle
import paddle
import paddle.fluid as fluid
import paddle.fluid as fluid
from paddle.incubate.hapi.text import CRFDecoding
from paddle.incubate.hapi.text import CRFDecoding
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录