MCPcopy Create free account
hub / github.com/chenhaoxing/HDNet / parse

Method parse

options/base_options.py:108–131  ·  view source on GitHub ↗

Parse our options, create checkpoints directory suffix, and set up gpu device.

(self)

Source from the content-addressed store, hash-verified

106 opt_file.write('\n')
107
108 def parse(self):
109 """Parse our options, create checkpoints directory suffix, and set up gpu device."""
110 opt = self.gather_options()
111 opt.isTrain = self.isTrain # train or test
112
113 # process opt.suffix
114 if opt.suffix:
115 suffix = ('_' + opt.suffix.format(**vars(opt))) if opt.suffix != '' else ''
116 opt.name = opt.name + suffix
117
118 self.print_options(opt)
119
120 # set gpu ids
121 str_ids = opt.gpu_ids.split(',')
122 opt.gpu_ids = []
123 for str_id in str_ids:
124 id = int(str_id)
125 if id >= 0:
126 opt.gpu_ids.append(id)
127 if len(opt.gpu_ids) > 0:
128 torch.cuda.set_device(opt.gpu_ids[0])
129
130 self.opt = opt
131 return self.opt

Callers 1

train_evaluate.pyFile · 0.80

Calls 2

gather_optionsMethod · 0.95
print_optionsMethod · 0.95

Tested by

no test coverage detected