mlp_layer.py 文件源码

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

项目:textGAN_public 作者: dreasysnail 项目源码 文件源码
def middle_layer(tparams, layer1_input, prefix='mlp_layer'):

    """ layer1_input:  n_sample * n_feature    64*20
        input_shape: (num of hiddens, number of input features)   200*20
        pred_shape: (num of labels, number of hiddens) 2*200
        y_recon : n_label *n_sample 2*64
    """
    hidden_2_out = tensor.nnet.sigmoid(tensor.dot(layer1_input, tparams[_p(prefix,'W1')].T) + tparams[_p(prefix,'b1')] )  # 64*200  
    # y_recons = tensor.dot(hidden_2_out, tparams[_p(prefix,'V1')].T) + tparams[_p(prefix,'c1')]  # avoid numerical issues
    # y_recons = tensor.nnet.softmax(y_recons) # 64*2

    return hidden_2_out
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号