def array_dot(vec1, vec2):
    """
    Calculate dot products between vectors in rows of numpy arrays.
    """
    if vec1.ndim == 1:
        product = (vec1 * vec2).sum()
    else:
        product = (vec1 * vec2).sum(axis=1).reshape(-1, 1)
    return product
