Esempio n. 1
0
def make_policy(epochs, params, lr, momentum, wd):
    optimizer = SGD(params, lr, momentum=momentum, weight_decay=wd)

    # this creates a scheduler which is used to adjust the learning rate, many of the scheduler are defined , choose one as per your need
    # check if the policy is right
    scheduler = PolyPolicy(optimizer, epochs, 1)
    return optimizer, scheduler
def make_policy(epochs, network, lr, momentum):
    optimizer = Adam([
        {'params': network.parameters(), 'lr': lr},
    ], weight_decay=1e-4)

    # this creates a scheduler which is used to adjust the learning rate, many of the scheduler are defined , choose one as per your need
    # check if the policy is right
    scheduler = PolyPolicy(optimizer, epochs, 1)
    return optimizer, scheduler
def make_policy(epochs, network, lr, momentum, wd):
    optimizer = SGD([
        {
            'params': network.parameters(),
            'lr': lr
        },
    ],
                    momentum=momentum,
                    weight_decay=wd)
    scheduler = PolyPolicy(optimizer, epochs, 1)
    return optimizer, scheduler
Esempio n. 4
0
def make_policy(epochs, network, lr, momentum, wd):
    optimizer = SGD(filter(lambda p: p.requires_grad, network.parameters()), lr = lr, momentum=momentum, weight_decay=wd)
    scheduler = PolyPolicy(optimizer, epochs, 1)
    return optimizer, scheduler