Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. def generate_window_sequence(self, sentence_ix, sentence, label):
  2. window_sequences = []
  3. offset = int(self.window_size/2)
  4. ws = tf.strings.split([sentence], sep=' ').values
  5. ls = ws.get_shape()[0].value
  6. print(ls)
  7. for i in range(offset, ls-offset):
  8.  
  9. window_sequences.append((tf.gather_nd(ws, [i-offset]), tf.gather_nd(ws, [i]) ))
  10. window_sequences.append((tf.gather_nd(ws, [i+offset]), tf.gather_nd(ws, [i]) ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement