def softmax(x):
    shifted = x - np.max(x, axis=1, keepdims=True)
    expx = np.exp(shifted)
    return expx / np.sum(expx, axis=1, keepdims=True)
dataset/ETHPy150Open rllab/rllab/rllab/misc/special.py/softmax/original