import tensorflow as tf

    
    # do logit = W*X+b
    logit = tf.nn.xw_plus_b(H_drop, W, b, name="scores")
    predictions = tf.nn.softmax(logit, name="predictions")


#claulate loss and optimizer
with tf.variable_scope("FCoptimize", reuse=None):
    loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits= logit, labels=Y)
                          + l2_reg_lambda * l2_loss)
    optimizer = tf.train.AdamOptimizer(learning_rate).minimize(loss)


# calculate accuracy
correct_predictions = tf.equal(tf.argmax(predictions, 1), tf.argmax(Y, 1))
accuracy = tf.reduce_mean(tf.cast(correct_predictions, "float"), name="accuracy")
