MCPcopy
hub / github.com/ladaapp/lada / save

Function save

lada/models/deepmosaics/models/model_util.py:18–24  ·  view source on GitHub ↗
(net,path,gpu_id)

Source from the content-addressed store, hash-verified

16
17################################## IO ##################################
18def save(net,path,gpu_id):
19 if isinstance(net, nn.DataParallel):
20 torch.save(net.module.cpu().state_dict(),path)
21 else:
22 torch.save(net.cpu().state_dict(),path)
23 if gpu_id != '-1':
24 net.cuda()
25
26def todevice(net,gpu_id):
27 if gpu_id != '-1' and len(gpu_id) == 1:

Callers

nothing calls this directly

Calls 1

saveMethod · 0.45

Tested by

no test coverage detected