Wang Xin 045e5f6ac7
add pre-commit workflow (#11973)
* add pre-commit workflow

* run 'pre-commit run --all-files'

* setup python version
2024-04-21 21:46:20 +08:00

17 lines
415 B
Python

# -*- coding: utf-8 -*-
# @Time : 2020/6/5 11:36
# @Author : zhoujun
import copy
from .DB_loss import DBLoss
__all__ = ["build_loss"]
support_loss = ["DBLoss"]
def build_loss(config):
copy_config = copy.deepcopy(config)
loss_type = copy_config.pop("type")
assert loss_type in support_loss, f"all support loss is {support_loss}"
criterion = eval(loss_type)(**copy_config)
return criterion