init_op = tf.initialize_all_variables()
sess = tf.Session()
sess.run([init_op])
print('Values before:', sess.run([data]))
sess.run([sparse_update])
print('Values after:', sess.run([data]))
Update a subset of weights in TensorFlow