MCPcopy Create free account
hub / github.com/open-mmlab/mmengine / value2list

Function value2list

mmengine/visualization/utils.py:27–42  ·  view source on GitHub ↗

If the type of ``value`` is ``valid_type``, convert the value to list and expand to ``expand_dim``. Args: value (Any): value. valid_type (Union[Type, Tuple[Type, ...]): valid type. expand_dim (int): expand dim. Returns: List[Any]: value.

(value: Any, valid_type: Union[Type, Tuple[Type, ...]],
               expand_dim: int)

Source from the content-addressed store, hash-verified

25
26
27def value2list(value: Any, valid_type: Union[Type, Tuple[Type, ...]],
28 expand_dim: int) -> List[Any]:
29 """If the type of ``value`` is ``valid_type``, convert the value to list
30 and expand to ``expand_dim``.
31
32 Args:
33 value (Any): value.
34 valid_type (Union[Type, Tuple[Type, ...]): valid type.
35 expand_dim (int): expand dim.
36
37 Returns:
38 List[Any]: value.
39 """
40 if isinstance(value, valid_type):
41 value = [value] * expand_dim
42 return value
43
44
45def check_type(name: str, value: Any,

Callers 2

draw_textsMethod · 0.90
draw_binary_masksMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…