!parametersArray[UPDATER_SPARSE_REMOTE].empty()
Created by: 20092136
def dnn_net(seq_dim,
feat_dim,
class_dim,
emb_dim=128,
hid_dim=512,
lstm_dim=128,
is_predict=False):
"""
DNN
"""
bias_attr = ParameterAttribute(initial_std=0., l2_rate=0.0001)
fc_para_attr = ParameterAttribute(learning_rate=2e-3)
lstm_para_attr = ParameterAttribute(initial_std=0., learning_rate=2e-3)#, sparse_update=True)
sparse_up = ParameterAttribute(sparse_update=True)
para_attr = [lstm_para_attr, fc_para_attr]
relu = ReluActivation()
feat_data = data_layer("feat", feat_dim)
feat_layer_1 = fc_layer(input=feat_data, size=hid_dim, act=relu,
bias_attr=bias_attr, param_attr=sparse_up)
feat_layer_2 = fc_layer(input=feat_layer_1, size=hid_dim, bias_attr=bias_attr)
feat_layer_3 = fc_layer(input=feat_layer_2, size=hid_dim, bias_attr=bias_attr)
output = fc_layer(name='fc_ly_4', input=feat_layer_3, size=class_dim, act=SoftmaxActivation(),
bias_attr=bias_attr, param_attr=fc_para_attr)
if is_predict:
outputs(output)
else:
outputs(
classification_cost(input=output, label=data_layer('label', 1),
obj.input_types = [sparse_non_value_slot(6121), integer_value(888)]
use_remote_sparse = True,