import torch


def bound_and_scale(scale, bounds):
    """
    Combination of scaling and bounding

    Args:
      scale (torch.tensor):     divide input by this value
      bounds (torch.tensor):    tuple, clamp to (bounds[0], bounds[1])
    """
    return lambda x: torch.clamp(x / scale, bounds[0], bounds[1])