From 3522051886b206caf035af77224ec3d21b3c7d5d Mon Sep 17 00:00:00 2001 From: LordSomen Date: Fri, 31 Aug 2018 13:42:16 +0530 Subject: [PATCH] assigning when executing --- Tensorflow/tf_assign.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Tensorflow/tf_assign.py diff --git a/Tensorflow/tf_assign.py b/Tensorflow/tf_assign.py new file mode 100644 index 0000000..2b8b765 --- /dev/null +++ b/Tensorflow/tf_assign.py @@ -0,0 +1,10 @@ +#%% +import tensorflow as tf +x = tf.Variable(tf.random_uniform(shape=(),minval=0.0,maxval=1.0)) +x_new_val = tf.placeholder(shape=(),dtype=tf.float32) +x_assign = tf.assign(x, x_new_val) +with tf.Session(): + x.initializer.run() + print(x.eval()) + x_assign.eval(feed_dict={x_new_val: 5.0}) + print(x.eval()) \ No newline at end of file