def param_init_mlp_layer(input_shape, pred_shape, params, prefix='mlp_layer'):
""" input_shape: (num of hiddens, number of input features)
pred_shape: (num of labels, number of hiddens)
"""
W1 = np.asarray(rng.uniform(low=-0.01,high=0.01,size=input_shape),dtype=theano.config.floatX)
b1 = np.ones((input_shape[0],), dtype=theano.config.floatX)*0.01 # initialize as 1 rather than 0
V1 = np.asarray(rng.uniform(low=-0.01,high=0.01,size=pred_shape),dtype=theano.config.floatX) # 2*200
c1 = np.ones((pred_shape[0],), dtype=theano.config.floatX)*0.01 # initialize as 1
params[_p(prefix,'W1')] = W1
params[_p(prefix,'b1')] = b1
params[_p(prefix,'V1')] = V1
params[_p(prefix,'c1')] = c1
return params
评论列表
文章目录