def polyschedule(max_epochs, gamma=0.9):
    """Poly-learning rate policy popularised by DeepLab-v2: https://arxiv.org/abs/1606.00915

    Args:
      max_epochs (int): maximum number of epochs, at which the multiplier becomes zero.
      gamma (float): decay factor.

    Returns:
      Callable that takes the current epoch as an argument and returns the learning rate multiplier.

    """

    def polypolicy(epoch):
        return (1.0 - 1.0 * epoch / max_epochs) ** gamma

    return polypolicy