<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _set_tf_functions(self):
 """ Sets up summary writer, saver, and session, with configurable gpu visibility """

        merged = tf.summary.merge_all()
        saver = tf.train.Saver()
        if type(self.flags['GPU']) is int:
            os.environ["CUDA_VISIBLE_DEVICES"] = str(self.flags['GPU'])
            print('Using GPU %d' % self.flags['GPU'])
        gpu_options = tf.GPUOptions(allow_growth=True)
        config = tf.ConfigProto(log_device_placement=False, gpu_options=gpu_options)
        sess = tf.Session(config=config)
        writer = tf.summary.FileWriter(self.flags['LOGGING_DIRECTORY'], sess.graph)
        return merged, saver, sess, writer