From 0b06db9413c6d752188f8d450f0b19070972a2f6 Mon Sep 17 00:00:00 2001 From: JesseyXujin Date: Mon, 9 Sep 2019 10:45:53 +0800 Subject: [PATCH] delete transmission args in linear_chain_crf op (#19619) * delete args on linear_chain_crf_op doc * delete args on linear_chain_crf_op doc * delete args on linear_chain_crf_op doc * add code example * fix api doc * fix doc of crf * fix doc of crf * add test=develop * modify API.spec, test=develop --- paddle/fluid/API.spec | 2 +- python/paddle/fluid/layers/nn.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/API.spec b/paddle/fluid/API.spec index d2697814e29..da5aa0da49b 100755 --- a/paddle/fluid/API.spec +++ b/paddle/fluid/API.spec @@ -115,7 +115,7 @@ paddle.fluid.layers.dynamic_lstm (ArgSpec(args=['input', 'size', 'h_0', 'c_0', ' paddle.fluid.layers.dynamic_lstmp (ArgSpec(args=['input', 'size', 'proj_size', 'param_attr', 'bias_attr', 'use_peepholes', 'is_reverse', 'gate_activation', 'cell_activation', 'candidate_activation', 'proj_activation', 'dtype', 'name', 'h_0', 'c_0', 'cell_clip', 'proj_clip'], varargs=None, keywords=None, defaults=(None, None, True, False, 'sigmoid', 'tanh', 'tanh', 'tanh', 'float32', None, None, None, None, None)), ('document', 'c37d51aad655c8a9f9b045c64717320a')) paddle.fluid.layers.dynamic_gru (ArgSpec(args=['input', 'size', 'param_attr', 'bias_attr', 'is_reverse', 'gate_activation', 'candidate_activation', 'h_0', 'origin_mode'], varargs=None, keywords=None, defaults=(None, None, False, 'sigmoid', 'tanh', None, False)), ('document', '83617c165827e030636c80486d5de6f3')) paddle.fluid.layers.gru_unit (ArgSpec(args=['input', 'hidden', 'size', 'param_attr', 'bias_attr', 'activation', 'gate_activation', 'origin_mode'], varargs=None, keywords=None, defaults=(None, None, 'tanh', 'sigmoid', False)), ('document', '33974b9bfa69f2f1eb85e6f956dff04e')) -paddle.fluid.layers.linear_chain_crf (ArgSpec(args=['input', 'label', 'param_attr', 'length'], varargs=None, keywords=None, defaults=(None, None)), ('document', '715f8f12d68ae90504a7b768e82be6f4')) +paddle.fluid.layers.linear_chain_crf (ArgSpec(args=['input', 'label', 'param_attr', 'length'], varargs=None, keywords=None, defaults=(None, None)), ('document', '9045b8971e4232132ec9952695f4c3ae')) paddle.fluid.layers.crf_decoding (ArgSpec(args=['input', 'param_attr', 'label'], varargs=None, keywords=None, defaults=(None,)), ('document', '5ce117258e243be1c81539e254178d90')) paddle.fluid.layers.cos_sim (ArgSpec(args=['X', 'Y'], varargs=None, keywords=None, defaults=None), ('document', '8e6ce424cf9e261ef32ee229c06a6e66')) paddle.fluid.layers.cross_entropy (ArgSpec(args=['input', 'label', 'soft_label', 'ignore_index'], varargs=None, keywords=None, defaults=(False, -100)), ('document', 'f43c659ca1749a3f0ff2231e6dfda07d')) diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index e6809804a62..20735aa23b6 100755 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -1414,10 +1414,9 @@ def linear_chain_crf(input, label, param_attr=None, length=None): Args: input(${emission_type}): ${emission_comment} - input(${transition_type}): ${transition_comment} label(${label_type}): ${label_comment} Length(${length_type}): ${length_comment} - param_attr(ParamAttr): The attribute of the learnable parameter. + param_attr(ParamAttr): The attribute of the learnable parameter for transition parameter. Returns: output(${emission_exps_type}): ${emission_exps_comment} \n @@ -1483,6 +1482,10 @@ def linear_chain_crf(input, label, param_attr=None, length=None): loss2= exe.run(train_program,feed=feed2, fetch_list=[crf_cost2]) print(loss2) + + #you can use find_var to get transition parameter. + transition=np.array(fluid.global_scope().find_var('crfw').get_tensor()) + print(transition) """ helper = LayerHelper('linear_chain_crf', **locals()) size = input.shape[1] -- GitLab