1. 程式人生 > >tf.assign函式的用法

tf.assign函式的用法

    import tensorflow as tf     import numpy as np     A = tf.Variable(tf.ones([2,2]), dtype=tf.float32)       with tf.Session() as sess:           sess.run(tf.global_variables_initializer())           print("原始的A ")         print(sess.run(A))           sess.run(tf.assign(A,np.zeros([2,2])))           print("現在的A ")         print(sess.run(A))