fluid.ParamAttr的使用问题
Created by: ARDUJS
环境
- paddle = 1.7.2
- python = 3.7.5
问题
unpad_feature, seq_len_used = embedding_layer()
res = []
## 标签1的发射状态特征权重
emission_1 = fluid.layers.fc(size=class_num,input=unpad_feature,param_attr=fluid.ParamAttr(
initializer=fluid.initializer.Uniform(low=-0.1, high=0.1),
regularizer=fluid.regularizer.L2DecayRegularizer(regularization_coeff=1e-4)))
size = emission_1.shape[1]
## 标签1的转移特征权重
w1 = fluid.layers.create_parameter(
shape=[size + 2, size], dtype=emission_1.dtype, name='crfw_1')
## 预测标签1
ret_infers_1 = fluid.layers.crf_decoding(
input=emission_1, param_attr=fluid.ParamAttr(name='crfw_1'))
infers_1 = fluid.layers.assign(ret_infers_1)
res.append(infers_1)
## 标签2的发射状态特征权重
emission_2 = fluid.layers.fc(size=class_num,input=emission_1,param_attr=fluid.ParamAttr(
initializer=fluid.initializer.Uniform(low=-0.1, high=0.1),
regularizer=fluid.regularizer.L2DecayRegularizer(regularization_coeff=1e-4)))
## 标签2的转移特征权重
w2 = layers.fc(size=size, input=w1, name="crfw_2")
# w2 = fluid.layers.create_parameter(
# shape=[size + 2, size], dtype=emission_1.dtype, name='crfw_2')
## 预测标签2
ret_infers_2 = fluid.layers.crf_decoding(
input=emission_2, param_attr=fluid.ParamAttr(name='crfw_2'))
infers_2 = fluid.layers.assign(ret_infers_2)
res.append(infers_2)
传入 fluid.layers.crf_decoding的param_attr参数,我想是w1通过fc所获得的变量传入,我在实现上出了问题,求大佬帮助