Files
HSAP/algorithms/lane_ufld/code/CLRNet-main/clrnet/engine/optimizer.py
Chengfang Lu 7c43b44c57 feat: initial HSAP platform
Huaxu Sentinel Active Safety Platform with embedded algorithm code,
Docker Compose setup, and vendored dataset scaffolds for clone-and-run.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-25 16:59:59 +08:00

14 lines
327 B
Python

import torch
def build_optimizer(cfg, net):
params = []
cfg_cp = cfg.optimizer.copy()
cfg_type = cfg_cp.pop('type')
if cfg_type not in dir(torch.optim):
raise ValueError("{} is not defined.".format(cfg_type))
_optim = getattr(torch.optim, cfg_type)
return _optim(net.parameters(), **cfg_cp)