import tensorflow as tf import numpy as np import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' def foo01(): x = np.array([[1, 1, 1], [1, -8, 1], [1, 1, 1]]) w = tf.Variable(initial_value=x) sess = tf.Session() sess.run(tf.global_variables_initializer()) print(sess.run(w)) def foo02(): x = tf.Variable(3) y = tf.Variable(5) z = tf.add(x, y) sess = tf.Session() sess.run(tf.global_variables_initializer()) print(sess.run(z)) def foo03(): a = tf.Variable(tf.ones([3, 2])) b = tf.Variable(tf.ones([2, 3])) product = tf.matmul(5.0 * a, 4.0 * b) sess = tf.Session() sess.run(tf.global_variables_initializer()) print(sess.run(product)) print(tf.__path__) foo01() foo02() foo03()