def softmax(X):
    # should work for both 2D and 3D
    e_X = tensor.exp(X - X.max(axis=-1, keepdims=True))
    out = e_X / e_X.sum(axis=-1, keepdims=True)
    return out
dataset/ETHPy150Open kastnerkyle/SciPy2015/graphics_code/cvae/kdl_template.py/softmax/original