class_docstr: 对于用户使用函数修饰器加入的 callback 函数，使用该 _CallbackWrapper 类为其进行定制，这一个类只保留用户的
  这一个 callback 函数；
class_docstr_tok: ["\u5bf9\u4e8e\u7528\u6237\u4f7f\u7528\u51fd\u6570\u4fee\u9970\u5668\u52a0\u5165\u7684","callback","\u51fd\u6570\uff0c\u4f7f\u7528\u8be5","_CallbackWrapper","\u7c7b\u4e3a\u5176\u8fdb\u884c\u5b9a\u5236\uff0c\u8fd9\u4e00\u4e2a\u7c7b\u53ea\u4fdd\u7559\u7528\u6237\u7684","\u8fd9\u4e00\u4e2a","callback","\u51fd\u6570\uff1b"]
docstr: :param event: 具体的 callback 时机，例如 'on_train_begin' 等；
  :param fn: 用户定制的 callback 函数；
docstr_tok: [":","param","event",":","\u5177\u4f53\u7684","callback","\u65f6\u673a\uff0c\u4f8b\u5982","'on_train_begin","'","\u7b49\uff1b",":","param","fn",":","\u7528\u6237\u5b9a\u5236\u7684","callback","\u51fd\u6570\uff1b"]
code: def __init__(self, event: Event, fn: Callable):
      r"""
      :param event: 具体的 callback 时机，例如 'on_train_begin' 等；
      :param fn: 用户定制的 callback 函数；
      """
  
      self.fn = fn
      if isinstance(event, Event):
          _filter = Filter(event.every, event.once, event.filter_fn)
          setattr(self, event.value, _filter(fn))
  
imports: from typing import Callable, Dict, Optional
  from .callback_event import Event, Filter
label_desc: Use image node_id 1 to create a new _CallbackWrapper object from inherited base classes: Callback with example: obj = _CallbackWrapper(event, fn)