(a_dict)
| 181 | |
| 182 | |
| 183 | def dict2cpu(a_dict): |
| 184 | tmp = {} |
| 185 | for key, value in a_dict.items(): |
| 186 | if isinstance(value, torch.Tensor): |
| 187 | tmp.update({key: value.cpu()}) |
| 188 | elif isinstance(value, dict): |
| 189 | tmp.update({key: dict2cpu(value)}) |
| 190 | elif isinstance(value, list): |
| 191 | if isinstance(value[0], torch.Tensor): |
| 192 | tmp.update({key: [v.cpu() for v in value]}) |
| 193 | else: |
| 194 | tmp.update({key: value}) |
| 195 | return tmp |
| 196 | |
| 197 | |
| 198 | def reg_schedule(it, num_steps=1e6, lr0=1e-3, lrn=1e-4): |
nothing calls this directly
no outgoing calls
no test coverage detected