In [1]:
import tensorflow as tf

In [2]:
tf.TF_CPP_MIN_LOG_LEVEL = 3

In [3]:
# Create a constant operation. This operation is added as a node to the default graph.

hello = tf.constant("hello world")

# Start a TensorFlow session.

sess = tf.Session()

# Run the operation and get the result.

print(sess.run(hello))


hello world

In [4]:
node1 = tf.constant(3.0, tf.float32)
node2 = tf.constant(4.0) # (also tf.float32 by default)
node3 = tf.add(node1, node2)

print("node1: {node}".format(node = node1))
print("node2: {node}".format(node = node2))
print("node3: {node}".format(node = node3))


node1: Tensor("Const_1:0", shape=(), dtype=float32)
node2: Tensor("Const_2:0", shape=(), dtype=float32)
node3: Tensor("Add:0", shape=(), dtype=float32)

In [ ]: