nn.py 文件源码

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

项目:kaggle-review 作者: daxiongshu 项目源码 文件源码
def _build(self):
        V = self.V
        M = self.flags.embedding_size # 64
        H = self.flags.num_units 
        C = self.flags.classes
        D = self.flags.d2v_size # embedding for d2v

        netname = "D2V"
        with tf.variable_scope(netname):
            self.inputs = tf.placeholder(dtype=tf.int32,shape=[None]) #[B]
            layer_name = "{}/embedding".format(netname)
            x = self._get_embedding(layer_name, self.inputs, V, D, reuse=False) # [B, S, M]

        netname = "NN"
        cell_name = self.flags.cell
        H1,H2 = 32,16
        with tf.variable_scope(netname):
            net = self._fc(x, fan_in=D, fan_out=H1, layer_name="%s/fc1"%netname, activation='relu')
            net = self._dropout(net)
            net = self._fc(net, fan_in=H1, fan_out=H2, layer_name="%s/fc2"%netname, activation='relu')
            net = self._dropout(net)
            net = self._fc(net, fan_in=H2, fan_out=C, layer_name="%s/fc3"%netname, activation=None)
            self.logit = net
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号