JA_Hybrid_BiGRU.py 文件源码

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

项目:NANHM-for-GEC 作者: shinochin 项目源码 文件源码
def __init__(self, n_layers, n_source_vocab, n_target_vocab, n_source_char, n_target_char, n_units, n_sentences):
        super(Seq2seq, self).__init__(
            embed_x=L.EmbedID(n_source_vocab, n_units),
            embed_y=L.EmbedID(n_target_vocab, n_units * 2),
            embed_xc=L.EmbedID(n_source_char, n_units),
            embed_yc=L.EmbedID(n_target_char, n_units),
            encoder_f=L.NStepGRU(n_layers, n_units, n_units, 0.1),
            encoder_b=L.NStepGRU(n_layers, n_units, n_units, 0.1),
            char_encoder=L.NStepGRU(n_layers, n_units, n_units, 0.1),
            decoder=My.NStepGRU(n_layers, n_units * 2, n_units * 2, 0.1),
            char_decoder=L.NStepGRU(n_layers, n_units, n_units, 0.1),
            char_att_decoder=My.NStepGRU(n_layers, n_units, n_units, 0.1),
            W=L.Linear(n_units * 2, n_target_vocab),
            W_hat=L.Linear(n_units * 4, n_units),
            W_char=L.Linear(n_units, n_target_char),
        )
        self.n_layers = n_layers
        self.n_units = n_units
        self.n_params = 7
        self.n_sentences = n_sentences
        self.n_process = 0
        self.n_sen = len(str(n_sentences))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号