Skip to content

Instantly share code, notes, and snippets.

@hadifar
Created December 10, 2018 14:28
Show Gist options
  • Save hadifar/8192ed158b8b0e6024691de04a36a5d2 to your computer and use it in GitHub Desktop.
Save hadifar/8192ed158b8b0e6024691de04a36a5d2 to your computer and use it in GitHub Desktop.
elems = np.array(['H', 'e', 'l', 'l', 'o', ' ', 'T', 'e', 'n', 's', 'o', 'r'])
sum = tf.scan(lambda a, x: a + x, elems)
>>> ['H' 'He' 'Hel' 'Hell' 'Hello' 'Hello ' 'Hello T' 'Hello Te'
'Hello Ten' 'Hello Tens' 'Hello Tenso' 'Hello Tensor']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment