ComfyUI/comfy/annotator/uniformer/mmcv/runner/hooks/closure.py
2023-02-17 21:15:35 +07:00

12 lines
269 B
Python

# Copyright (c) OpenMMLab. All rights reserved.
from .hook import HOOKS, Hook
@HOOKS.register_module()
class ClosureHook(Hook):
def __init__(self, fn_name, fn):
assert hasattr(self, fn_name)
assert callable(fn)
setattr(self, fn_name, fn)