mlp_layer.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:textGAN_public 作者: dreasysnail 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号