<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 <a href="https
Step1:  First define a computational graph composed of operations and tensors
the main object you manipulate and pass around is the tf.Tensor. 
a tf.Tensor object represents a partially defined computation that will eventually produce a value
tf.Tensor is a generalization of vectors and matrices to potentially higher dimensions
TensorFlow represents tf.Tensor as n-dimensional arrays of base datatypes
TensorFlow programs work by first building a graph of tf.Tensor object
detailing how each tensor is computed based on the other available tensors by running parts of this graph to achieve the desired results
https
Step2:  Then use a session to execute the graph
Step3:  Graphs can be executed on CPU, GPU, and even TPU
Step4:  Feeding data to a graph
<ASSISTANT_TASK:>
Python Code:
# import and check version
import tensorflow as tf
# tf can be really verbose
tf.logging.set_verbosity(tf.logging.ERROR)
print(tf.__version__)
# a small sanity check, does tf seem to work ok? 
hello = tf.constant('Hello TF!')
sess = tf.Session()
print(sess.run(hello))
sess.close()
Explanation: <a href="https://colab.research.google.com/github/DJCordhose/ai/blob/master/notebooks/tensorflow/tf_low_level_intro.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Low Level TensorFlow, Part I: Basics
https://www.tensorflow.org/guide/low_level_intro
End of explanation
a = tf.constant(3.0, dtype=tf.float32) # special type of tensor
b = tf.constant(4.0) # also tf.float32 implicitly
total = a + b
print(a)
print(b)
print(total)
# types need to match
try:
  tf.constant(3.0, dtype=tf.float32) + tf.constant(4, dtype=tf.int32)
except TypeError as te:
  print(te)
# https://www.tensorflow.org/api_docs/python/tf/dtypes/cast
a = tf.constant(3, dtype=tf.int32)
b = tf.cast(tf.constant(4.0, dtype=tf.float32), tf.int32)
int_total = a + b
int_total
Explanation: First define a computational graph composed of operations and tensors
the main object you manipulate and pass around is the tf.Tensor. 
a tf.Tensor object represents a partially defined computation that will eventually produce a value
tf.Tensor is a generalization of vectors and matrices to potentially higher dimensions
TensorFlow represents tf.Tensor as n-dimensional arrays of base datatypes
TensorFlow programs work by first building a graph of tf.Tensor object
detailing how each tensor is computed based on the other available tensors by running parts of this graph to achieve the desired results
https://www.tensorflow.org/guide/tensors
End of explanation
# sessions need to be closed in order not to leak ressources, this makes sure close is called in any case
with tf.Session() as sess:
  print(sess.run(total))
#   print(sess.run(int_total))
Explanation: Then use a session to execute the graph
End of explanation
# let's see what compute devices we have available, hopefully a GPU 
# if you do not see it, switch on under Runtime->Change runtime type
with tf.Session() as sess:
  devices = sess.list_devices()
  for d in devices:
      print(d.name)
tf.test.gpu_device_name()
# GPU requires nvidia cuda
tf.test.is_built_with_cuda()
with tf.device("/device:XLA_CPU:0"):
  with tf.Session() as sess:
    print(sess.run(total))
Explanation: Graphs can be executed on CPU, GPU, and even TPU
End of explanation
x = tf.placeholder(tf.float32)
y = tf.placeholder(tf.float32)
z = x + y
with tf.Session() as sess:
  try:
    print(sess.run(z))
  except tf.errors.InvalidArgumentError as iae:
     print(iae.message)
with tf.Session() as sess:
    print(sess.run(z, feed_dict={x: 3.0, y: 4.5}))
Explanation: Feeding data to a graph
End of explanation
<END_TASK>