(module: torch.nn.Module, prefix="")
| 137 | # PyTorch's `_load_from_state_dict` does not copy parameters in a module's descendants |
| 138 | # so we need to apply the function recursively. |
| 139 | def load(module: torch.nn.Module, prefix=""): |
| 140 | args = (state_dict, prefix, {}, True, [], [], error_msgs) |
| 141 | module._load_from_state_dict(*args) |
| 142 | |
| 143 | for name, child in module._modules.items(): |
| 144 | if child is not None: |
| 145 | load(child, prefix + name + ".") |
| 146 | |
| 147 | load(model_to_load) |
| 148 |
no outgoing calls
no test coverage detected