_test_gru.py 文件源码

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

项目:cortex 作者: rdevon 项目源码 文件源码
def test_make_gru(dim_in=31, dim_h=11, dim_out=None,
                  i_net=None, a_net=None, o_net=None, c_net=None):
    print 'Testing GRU formation'

    if i_net is None:
        i_net = dict(
            dim_h=17,
            n_layers=2,
            h_act='T.tanh',
            weight_scale=0.1,
        )
    if a_net is None:
        a_net = dict(
            dim_h=19,
            n_layers=2,
            h_act='T.tanh',
            weight_scale=0.1
        )
    if o_net is None:
        o_net = dict(
            dim_h=23,
            n_layers=2,
            weight_scale=0.1,
            distribution='binomial'
        )

    nets = dict(i_net=i_net, a_net=a_net, o_net=o_net, c_net=c_net)

    trng = RandomStreams(101)

    rnn = GRU.factory(dim_in=dim_in, dim_hs=[dim_h], dim_out=dim_out, **nets)
    rnn.set_tparams()
    print 'GRU formed correctly'

    return rnn
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号