def appstart(stri):
    mnist = input_data.read_data_sets('../Data/MNIST_data', one_hot=True)
    x = tf.placeholder(tf.float32, [None, 784])
    y_ = tf.placeholder(tf.float32, [None, 10])
    if (stri == 'relu'):
        y_output = deepnnwithrelu(x)
    elif (stri == 'elu'):
        y_output = deepnnwithelu(x)
    else:
        y_output = deepnnwithsigmoid(x)
    with tf.name_scope('loss'):
        cross_entropy = tf.nn.softmax_cross_entropy_with_logits(labels=y_, logits=y_output)
    cross_entropy = tf.reduce_mean(cross_entropy)
    with tf.name_scope('adam_optimizer'):
        train_step = tf.train.AdamOptimizer(0.0001).minimize(cross_entropy)
    with tf.name_scope('accuracy'):
        correct_prediction = tf.equal(tf.argmax(y_output, 1), tf.argmax(y_, 1))
        correct_prediction = tf.cast(correct_prediction, tf.float32)
    accuracy = tf.reduce_mean(correct_prediction)
    graph_location = ('tfgraphs/' + expno)
    print(('Saving graph to: %s' % graph_location))
    train_writer = tf.summary.FileWriter(graph_location)
    train_writer.add_graph(tf.get_default_graph())
    resultarray = []
    iterarray = []
    accarray = []
    testaccarray = []
    with tf.Session() as sess:
        sess.run(tf.global_variables_initializer())
        for i in range(20000):
            batch = mnist.train.next_batch(50)
            if ((i % 100) == 0):
                train_accuracy = accuracy.eval(feed_dict={x: batch[0], y_: batch[1]})
                testaccuracy = accuracy.eval(feed_dict={x: mnist.test.images, y_: mnist.test.labels})
                iterarray.append(i)
                accarray.append(train_accuracy)
                testaccarray.append(testaccuracy)
            train_step.run(feed_dict={x: batch[0], y_: batch[1]})
        resultarray.append(iterarray)
        resultarray.append(accarray)
        resultarray.append(testaccarray)
    return resultarray
def appstart(stri):
    mnist = input_data.read_data_sets('../Data/MNIST_data', one_hot=True)
    x = tf.placeholder(tf.float32, [None, 784])
    y_ = tf.placeholder(tf.float32, [None, 10])
    if (stri == 'relu'):
        y_output = deepnnwithrelu(x)
    elif (stri == 'elu'):
        y_output = deepnnwithelu(x)
    else:
        y_output = deepnnwithsigmoid(x)
    with tf.name_scope('loss'):
        cross_entropy = tf.nn.softmax_cross_entropy_with_logits(labels=y_, logits=y_output)
    cross_entropy = tf.reduce_mean(cross_entropy)
    with tf.name_scope('adam_optimizer'):
        train_step = tf.train.AdamOptimizer(0.0001).minimize(cross_entropy)
    with tf.name_scope('accuracy'):
        correct_prediction = tf.equal(tf.argmax(y_output, 1), tf.argmax(y_, 1))
        correct_prediction = tf.cast(correct_prediction, tf.float32)
    accuracy = tf.reduce_mean(correct_prediction)
    graph_location = ('tfgraphs/' + expno)
    print(('Saving graph to: %s' % graph_location))
    train_writer = tf.summary.FileWriter(graph_location)
    train_writer.add_graph(tf.get_default_graph())
    resultarray = []
    iterarray = []
    accarray = []
    testaccarray = []
    with tf.Session() as sess:
        sess.run(tf.global_variables_initializer())
        for i in range(20000):
            batch = mnist.train.next_batch(50)
            if ((i % 100) == 0):
                train_accuracy = accuracy.eval(feed_dict={x: batch[0], y_: batch[1]})
                testaccuracy = accuracy.eval(feed_dict={x: mnist.test.images, y_: mnist.test.labels})
                iterarray.append(i)
                accarray.append(train_accuracy)
                testaccarray.append(testaccuracy)
            train_step.run(feed_dict={x: batch[0], y_: batch[1]})
        resultarray.append(iterarray)
        resultarray.append(accarray)
        resultarray.append(testaccarray)
    return resultarray