def euclidean_distances(X, Y=None, squared=False):
XX = np.sum(X * X, axis=<NUM_LIT:1>)[:, np.newaxis]<EOL>YY = np.sum(Y ** <NUM_LIT:2>, axis=<NUM_LIT:1>)[np.newaxis, :]<EOL>distances = np.dot(X, Y.T)<EOL>distances *= -<NUM_LIT:2><EOL>distances += XX<EOL>distances += YY<EOL>np.maximum(distances, <NUM_LIT:0>, distances)<EOL>if X is Y:<EOL><INDENT>distances.flat[::distances.shape[<NUM_LIT:0>] + <NUM_LIT:1>] = <NUM_LIT:0.0><EOL><DEDENT>return distances if squared else np.sqrt(distances)<EOL>
:param X:
:param Y:
:param Y_norm_squared:
:param squared:
:return: