import torch


def log_bound_and_scale(scale, bounds):
    """
    Scale, de-log, and bound

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