layers.py 文件源码

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

项目:gated_word_char_rlm 作者: nyu-dl 项目源码 文件源码
def fullyconnected_layer(tparams, state_below, options, prefix, activ='lambda x: x', **kwargs):
    """ 
    compute the forward pass for a fully connected layer

    Parameters
    ----------
    tparams      : OrderedDict of theano shared variables, {parameter name: value}
    state_below  : theano 3d tensor, input data, dimensions: (num of time steps, batch size, dim of vector)
    options      : dictionary, {hyperparameter: value}
    prefix       : string, layer name
    activ        : string, activation function: 'liner', 'tanh', or 'rectifier'

    Returns
    -------
                 : theano 3d tensor, output data, dimensions: (num of time steps, batch size, dim of vector)

    """
    return eval(activ)(tensor.dot(state_below, tparams[p_name(prefix, 'W')]) + tparams[p_name(prefix, 'b')])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号