model_base.py 文件源码

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

项目:wip-constrained-extractor 作者: brain-research 项目源码 文件源码
def __init__(self, model_inputs, rouge_scorer, hps):

    self.word_embedding = tf.get_variable(
        "word_embedding", [hps.vocab_size, hps.word_embedding_size])
    self.article_inputs = tf.nn.embedding_lookup(self.word_embedding,
                                                 model_inputs.sliced_article)

    self.stopworded_abstract_bag = tf.transpose(
        tf.sparse_tensor_dense_matmul(
            rouge_scorer.stem_projector_stopworded,
            tf.to_float(model_inputs.abstract_bag),
            adjoint_a=True,
            adjoint_b=True))

    with tf.variable_scope("article_enc"):

      article_outs = shared_util.deep_birnn(hps, self.article_inputs,
                                            model_inputs.article_len)

      self.article_feats = shared_util.relu(article_outs, hps.hidden_size)

    with tf.variable_scope("scorer"):
      self.word_logits = tf.reshape(
          shared_util.linear(self.article_feats, 1), [hps.batch_size, -1])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号