From d7da19ba640da9fc2ad4cc2d586e566ab208ff67 Mon Sep 17 00:00:00 2001 From: Guo Sheng Date: Thu, 21 Nov 2019 14:46:40 +0800 Subject: [PATCH] Update the code sample in cn doc of dynamic_gru and gru_unit. (#1607) --- doc/fluid/api_cn/layers_cn/dynamic_gru_cn.rst | 8 +++++--- doc/fluid/api_cn/layers_cn/gru_unit_cn.rst | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/fluid/api_cn/layers_cn/dynamic_gru_cn.rst b/doc/fluid/api_cn/layers_cn/dynamic_gru_cn.rst index 60c477559..081e84c40 100644 --- a/doc/fluid/api_cn/layers_cn/dynamic_gru_cn.rst +++ b/doc/fluid/api_cn/layers_cn/dynamic_gru_cn.rst @@ -60,9 +60,11 @@ dynamic_gru import paddle.fluid as fluid dict_dim, emb_dim = 128, 64 - data = fluid.layers.data(name='sequence', shape=[1], - dtype='int32', lod_level=1) - emb = fluid.layers.embedding(input=data, size=[dict_dim, emb_dim]) + data = fluid.data(name='sequence', + shape=[None], + dtype='int64', + lod_level=1) + emb = fluid.embedding(input=data, size=[dict_dim, emb_dim]) hidden_dim = 512 x = fluid.layers.fc(input=emb, size=hidden_dim * 3) hidden = fluid.layers.dynamic_gru(input=x, size=hidden_dim) diff --git a/doc/fluid/api_cn/layers_cn/gru_unit_cn.rst b/doc/fluid/api_cn/layers_cn/gru_unit_cn.rst index f78b317c3..a0385a997 100644 --- a/doc/fluid/api_cn/layers_cn/gru_unit_cn.rst +++ b/doc/fluid/api_cn/layers_cn/gru_unit_cn.rst @@ -57,12 +57,12 @@ Gated Recurrent Unit(GRU)循环神经网络计算单元。该OP用于完成 import paddle.fluid as fluid dict_dim, emb_dim = 128, 64 - data = fluid.layers.data(name='step_data', shape=[1], dtype='int32') - emb = fluid.layers.embedding(input=data, size=[dict_dim, emb_dim]) + data = fluid.data(name='step_data', shape=[None], dtype='int64') + emb = fluid.embedding(input=data, size=[dict_dim, emb_dim]) hidden_dim = 512 x = fluid.layers.fc(input=emb, size=hidden_dim * 3) - pre_hidden = fluid.layers.data( - name='pre_hidden', shape=[hidden_dim], dtype='float32') + pre_hidden = fluid.data( + name='pre_hidden', shape=[None, hidden_dim], dtype='float32') hidden = fluid.layers.gru_unit( input=x, hidden=pre_hidden, size=hidden_dim * 3) -- GitLab