tf_rntn.py 文件源码

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

项目:sentiment_analysis 作者: silverguo 项目源码 文件源码
def add_model_variable(self):
        with tf.variable_scope('embedding'):
            self.embedding = tf.get_variable(name='wVector', 
                                             shape=[len(self.lexicon), 
                                                    self.wordSize])
        with tf.variable_scope('weights'):
            self.tensorV = tf.get_variable(name='tensorV', 
                                           shape=[2 * self.wordSize, 
                                                  2 * self.wordSize, 
                                                  self.wordSize])
            self.linearW = tf.get_variable(name='linearW', 
                                           shape=[2 * self.wordSize, 
                                                  self.wordSize])
            self.softW = tf.get_variable(name='softW', 
                                         shape=[self.wordSize, 
                                                self.labelNum])
        with tf.variable_scope('bias'):
            self.linearB = tf.get_variable(name='linearB', 
                                           shape=[1, self.wordSize])
            self.softB = tf.get_variable(name='softB', 
                                         shape=[1, self.labelNum])
        self.modelArray = tf.TensorArray(tf.float32, size=0, 
                                         dynamic_size=True, 
                                         clear_after_read=False, 
                                         infer_shape=False)

    # word vector indice
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号