diff --git a/doc/fluid/api_cn/dygraph_cn/NCE_cn.rst b/doc/fluid/api_cn/dygraph_cn/NCE_cn.rst index 63bb80d14525c460efcfd91c52a59e687bf722b5..ab47ac1346a11c67e6569375883b2911a54949e3 100644 --- a/doc/fluid/api_cn/dygraph_cn/NCE_cn.rst +++ b/doc/fluid/api_cn/dygraph_cn/NCE_cn.rst @@ -42,7 +42,6 @@ NCE words.append(fluid.dygraph.base.to_variable(inp_word[i])) emb = fluid.Embedding( - 'embedding', size=[dict_size, 32], param_attr='emb.w', is_sparse=False) @@ -57,17 +56,17 @@ NCE embs3 = fluid.layers.concat(input=embs3, axis=1) nce = fluid.NCE( - num_total_classes=dict_size, - dim=embs3.shape[1], - num_neg_samples=2, - sampler="custom_dist", - custom_dist=nid_freq_arr.tolist(), - seed=1, - param_attr='nce.w', - bias_attr='nce.b') + num_total_classes=dict_size, + dim=embs3.shape[1], + num_neg_samples=2, + sampler="custom_dist", + custom_dist=nid_freq_arr.tolist(), + seed=1, + param_attr='nce.w', + bias_attr='nce.b') wl = fluid.layers.unsqueeze(words[label_word], axes=[0]) - nce_loss3 = nce(embs3, words[label_word]) + nce_loss3 = nce(embs3, wl) 属性 :::::::::::: diff --git a/doc/fluid/api_cn/dygraph_cn/PolynomialDecay_cn.rst b/doc/fluid/api_cn/dygraph_cn/PolynomialDecay_cn.rst index 52f2884190a070def29ac13f26cffa9e450644fe..e5c1bbd4468d88c20974db258164a4f70d59c597 100644 --- a/doc/fluid/api_cn/dygraph_cn/PolynomialDecay_cn.rst +++ b/doc/fluid/api_cn/dygraph_cn/PolynomialDecay_cn.rst @@ -52,10 +52,8 @@ PolynomialDecay total_step = 5000 end_lr = 0 with fluid.dygraph.guard(): + emb = fluid.dygraph.Embedding( [10, 10]) optimizer = fluid.optimizer.SGD( learning_rate = fluid.dygraph.PolynomialDecay( - start_lr, total_step, end_lr, power=1.0) ) - - - - + start_lr, total_step, end_lr, power=1.0), + parameter_list = emb.parameters())