| import torch | |
| from yacs.config import CfgNode as CN | |
| def lower_config(yacs_cfg): | |
| if not isinstance(yacs_cfg, CN): | |
| return yacs_cfg | |
| return {k.lower(): lower_config(v) for k, v in yacs_cfg.items()} | |
| def upper_config(dict_cfg): | |
| if not isinstance(dict_cfg, dict): | |
| return dict_cfg | |
| return {k.upper(): upper_config(v) for k, v in dict_cfg.items()} | |
| def detect_NaN(feat_0, feat_1): | |
| feat_0[torch.isnan(feat_0)] = 0 | |
| feat_1[torch.isnan(feat_1)] = 0 | |