import warnings


def scale_to_bounds(x, lower_bound, upper_bound):
    """
    DEPRECATRED: Use :obj:`~gpytorch.utils.grid.ScaleToBounds` instead.

    :param x: the input data
    :type x: torch.Tensor (... x n x d)
    :param float lower_bound: lower bound of scaled data
    :param float upper_bound: upper bound of scaled data
    :return: scaled data
    :rtype: torch.Tensor (... x n x d)
    """
    warnings.warn(
        "The `scale_to_bounds` method is deprecated. Use the `gpytorch.utils.grid.ScaleToBounds` module instead.",
        DeprecationWarning,
    )
    # Scale features so they fit inside grid bounds
    min_val = x.min()
    max_val = x.max()
    diff = max_val - min_val
    x = (x - min_val) * (0.95 * (upper_bound - lower_bound) / diff) + 0.95 * lower_bound
    return x