def METHOD_NAME(step_each_epoch, params):
    import paddle.fluid as fluid
    from paddle.fluid.regularizer import L2Decay
    learning_rate = params.learning_rate
    num_epochs = params.num_epochs
    if params.lr_policy == 'Cosine':
        learning_rate = fluid.layers.cosine_decay(
            learning_rate=learning_rate,
            step_each_epoch=step_each_epoch,
            epochs=num_epochs)
    elif params.lr_policy == 'Linear':
        learning_rate = fluid.layers.polynomial_decay(
            learning_rate=learning_rate,
            decay_steps=step_each_epoch * num_epochs,
            end_learning_rate=0.0,
            power=1.0)
    elif params.lr_policy == 'Piecewise':
        lr_decay_epochs = params.lr_decay_epochs
        values = [
            learning_rate * (0.1**i) for i in range(len(lr_decay_epochs) + 1)
        ]
        boundaries = [b * step_each_epoch for b in lr_decay_epochs]
        learning_rate = fluid.layers.piecewise_decay(
            boundaries=boundaries, values=values)
    optimizer = fluid.optimizer.Momentum(
        learning_rate=learning_rate,
        momentum=0.9,
        regularization=L2Decay(1e-04))
    return optimizer