mmeval.core.dispatch¶
- mmeval.core.dispatch = <mmeval.core.dispatcher._MMEvalDispatcher object>¶
A Dispatcher inherited from
plum.Dispatcher
that resolvetyping.ForwardRef
.This dispatcher tries to use
importlib.import_moudle
to 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.dispatch
can’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`')