How I can Obtain Text Vectors
Closed this issue · 2 comments
mustfkeskin commented
Hello
How i can get left and right text vectors before concatenation.
self.prediction(a, b, dropout_keep_prob)
I want to get "a" and "b" --> vectors
def __call__(self, a, b, dropout_keep_prob, name='prediction'):
x = self._features(a, b)
with tf.variable_scope(name):
x = tf.nn.dropout(x, dropout_keep_prob)
x = dense(x, self.args.hidden_size, activation=tf.nn.relu, name='dense_1')
x = tf.nn.dropout(x, dropout_keep_prob)
x = dense(x, self.args.num_classes, activation=None, name='dense_2')
return x
If I change this code to return directly a and b is that enough
Or is there another way without of changing any code
hitvoice commented
Sorry for the late reply.
If I change this code to return directly a and b is that enough
This should work.
Or is there another way without of changing any code
Alternatively, you can get a vector by its name, if you simply add something like this to the beginning of the function:
a = tf.identity(a, name='vector_a')
b = tf.identity(b, name='vector_b')
And use graph.get_tensor_by_name('vector_a:0')
and graph.get_tensor_by_name('vector_b:0')
to get these vectors afterwards.
mustfkeskin commented
This code works
Thank you
a = tf.identity(a, name='vector_a')
b = tf.identity(b, name='vector_b')