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
评论列表
文章目录