def METHOD_NAME(x, y):
    """Aligns x and y tensors to allow computations over pairs of their rows."""
    x_matrix = _to_matrix(x)
    y_matrix = _to_matrix(y)
    x_shape = x_matrix.shape
    y_shape = y_matrix.shape
    if y_shape[1] != x_shape[1]:  # dimensions do not match.
        raise ValueError(
            "The outermost dimensions of the input tensors should match. "
            f"Received y = {y_shape[1]} vs x = {x_shape[1]}."
        )
    x_tile = tf.tile(tf.expand_dims(x_matrix, 1), [1, y_shape[0], 1])
    y_tile = tf.tile(tf.expand_dims(y_matrix, 0), [x_shape[0], 1, 1])
    return x_tile, y_tile