import tensorflow as tf


def softmax(target, axis, name=None):
    max_axis = tf.reduce_max(target, axis, keep_dims=True)
    target_exp = tf.exp(target - max_axis)
    normalize = tf.reduce_sum(target_exp, axis, keep_dims=True)
    softmax = target_exp / normalize
