mmsegmentation/mmseg/core/utils/misc.py

18 lines
371 B
Python
Raw Normal View History

2020-07-07 20:52:19 +08:00
def add_prefix(inputs, prefix):
"""Add prefix for dict.
Args:
inputs (dict): The input dict with str keys.
prefix (str): The prefix to add.
Returns:
dict: The dict with keys updated with ``prefix``.
"""
outputs = dict()
for name, value in inputs.items():
outputs[f'{prefix}.{name}'] = value
return outputs