code: def __init__(self, should_have_aggregate_method, only_warn=False):
      super(AggregateMethodError, self).__init__(self)
      self.should_have_aggregate_method = should_have_aggregate_method
      self.only_warn = only_warn
  
file_path: fastNLP/fastNLP/core/metrics/utils.py
imports: from typing import Any
  from functools import wraps
  from fastNLP.envs.imports import _NEED_IMPORT_PADDLE, _NEED_IMPORT_TORCH
  from fastNLP.envs.utils import _module_available
label_desc: Use image node_id 1 to create a new AggregateMethodError object from inherited base classes: BaseException with example: obj = AggregateMethodError(should_have_aggregate_method, only_warn)