MCPcopy Create free account
hub / github.com/computational-imaging/bacon / dict2cpu

Function dict2cpu

training.py:183–195  ·  view source on GitHub ↗
(a_dict)

Source from the content-addressed store, hash-verified

181
182
183def 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
198def reg_schedule(it, num_steps=1e6, lr0=1e-3, lrn=1e-4):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected