def vectorized_app1(X):
    return 1 / np.exp(X[:, (None)] - X[..., (None)]).sum(1)

def vectorized_app2(X):
    exp_vals = np.exp(X)
return 1 / (exp_vals[:, (None)] / exp_vals[..., (None)]).sum(1)

def vectorized_app3(X):
    exp_vals = np.exp(X)
return 1 / np.einsum('ij,ik->ij', exp_vals, 1 / exp_vals)
Calculation/manipulation of numpy array