Shortcuts

mmengine.utils.iter_cast

mmengine.utils.iter_cast(inputs, dst_type, return_type=None)[源代码]

Cast elements of an iterable object into some type.

参数:
  • inputs (Iterable) – The input object.

  • dst_type (type) – Destination type.

  • return_type (type, optional) – If specified, the output object will be converted to this type, otherwise an iterator.

返回:

The converted object.

返回类型:

iterator or specified type