Skip to content

Instantly share code, notes, and snippets.

@MSWon
Created March 12, 2019 08:13
Show Gist options
  • Save MSWon/b5db609311b7b44554b2886cf4f49472 to your computer and use it in GitHub Desktop.
Save MSWon/b5db609311b7b44554b2886cf4f49472 to your computer and use it in GitHub Desktop.
padding zero vector not trainable via scatter_update
import tensorflow as tf
g = tf.Graph()
with g.as_default():
a = tf.Variable(initial_value=[[1, 2, 4, 0],[2, 4, 5, 8]])
b = tf.scatter_update(a, [0], [[0, 0, 0, 0]])
with tf.Session(graph=g) as sess:
sess.run(tf.initialize_all_variables())
print(sess.run(a))
print(sess.run(b))
print(sess.run(a))
'''
[[1 2 4 0]
[2 4 5 8]]
[[0 0 0 0]
[2 4 5 8]]
[[0 0 0 0]
[2 4 5 8]]
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment