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``.
(inputs, prefix)
| 13 | |
| 14 | |
| 15 | def add_prefix(inputs, prefix): |
| 16 | """Add prefix for dict. |
| 17 | |
| 18 | Args: |
| 19 | inputs (dict): The input dict with str keys. |
| 20 | prefix (str): The prefix to add. |
| 21 | |
| 22 | Returns: |
| 23 | |
| 24 | dict: The dict with keys updated with ``prefix``. |
| 25 | """ |
| 26 | |
| 27 | outputs = dict() |
| 28 | for name, value in inputs.items(): |
| 29 | outputs[f"{prefix}.{name}"] = value |
| 30 | |
| 31 | return outputs |
| 32 | |
| 33 | |
| 34 | class DepthEncoderDecoder(nn.Module): |
no outgoing calls
no test coverage detected