File size: 240 Bytes
8d015d4
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
from torch.optim import *


def make_optimizer(params, optimizer_spec):
    optimizer = {
        'sgd': SGD,
        'adam': Adam,
        'adamW': AdamW
    }[optimizer_spec['name']](params, **optimizer_spec['args'])
    return optimizer