Constructing the TensorFlow graph