mmeval.core.dispatch¶
- mmeval.core.dispatch = <mmeval.core.dispatcher._MMEvalDispatcher object>¶
A Dispatcher inherited from
plum.Dispatcherthat resolvetyping.ForwardRef.This dispatcher tries to use
importlib.import_moudleto import ForwardRerf type and convert unimportable type as a placeholder.With the
_MMEvalDispatcher, we can run the following code example without PyTorch installed, which isplum.dispatchcan’t do.Example
>>> from mmeval.core import dispatch
>>> @dispatch >>> def compute(x: 'torch.Tensor'): ... print('The input is a `torch.Tensor`')
>>> @dispatch >>> def compute(x: 'numpy.ndarray'): ... print('The input is a `numpy.ndarray`')