MCPcopy
hub / github.com/NVlabs/SPADE / parse

Method parse

options/base_options.py:148–178  ·  view source on GitHub ↗
(self, save=False)

Source from the content-addressed store, hash-verified

146 return new_opt
147
148 def parse(self, save=False):
149
150 opt = self.gather_options()
151 opt.isTrain = self.isTrain # train or test
152
153 self.print_options(opt)
154 if opt.isTrain:
155 self.save_options(opt)
156
157 # Set semantic_nc based on the option.
158 # This will be convenient in many places
159 opt.semantic_nc = opt.label_nc + \
160 (1 if opt.contain_dontcare_label else 0) + \
161 (0 if opt.no_instance else 1)
162
163 # set gpu ids
164 str_ids = opt.gpu_ids.split(',')
165 opt.gpu_ids = []
166 for str_id in str_ids:
167 id = int(str_id)
168 if id >= 0:
169 opt.gpu_ids.append(id)
170 if len(opt.gpu_ids) > 0:
171 torch.cuda.set_device(opt.gpu_ids[0])
172
173 assert len(opt.gpu_ids) == 0 or opt.batchSize % len(opt.gpu_ids) == 0, \
174 "Batch size %d is wrong. It must be a multiple of # GPUs %d." \
175 % (opt.batchSize, len(opt.gpu_ids))
176
177 self.opt = opt
178 return self.opt

Callers 2

train.pyFile · 0.80
test.pyFile · 0.80

Calls 3

gather_optionsMethod · 0.95
print_optionsMethod · 0.95
save_optionsMethod · 0.95

Tested by

no test coverage detected