chain_main_relu_moe_model.py 文件源码

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

项目:youtube-8m 作者: wangheda 项目源码 文件源码
def create_model(self, model_input, vocab_size, num_mixtures=None,
                   l2_penalty=1e-8, sub_scope="", original_input=None, **unused_params):
    num_supports = FLAGS.num_supports
    input_size = model_input.shape.as_list()[1]
    support_predictions = self.sub_model(model_input, num_supports, sub_scope=sub_scope+"-support")
    main_relu = slim.fully_connected(
        model_input,
        input_size,
        activation_fn=tf.nn.relu,
        weights_regularizer=slim.l2_regularizer(l2_penalty),
        scope="main-relu-"+sub_scope)
    main_input = tf.concat([main_relu, support_predictions], axis=1)
    main_predictions = self.sub_model(main_input, vocab_size, sub_scope=sub_scope+"-main")
    return {"predictions": main_predictions, "support_predictions": support_predictions}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号