Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.optimizer_names.append(opt_name)
model_params = getattr(self, key).parameters()
if "args" in opt:
setattr(self, opt_name, (opt["name"](model_params, **opt["args"])))
else:
setattr(self, opt_name, (opt["name"](model_params)))
if "scheduler" in opt:
sched = opt["scheduler"]
if "args" in sched:
self.schedulers.append(
sched["name"](getattr(self, opt_name), **sched["args"])
)
else:
self.schedulers.append(sched["name"](getattr(self, opt_name)))
self.logger = Logger(
self,
losses_list,
metrics_list,
log_dir=log_dir,
nrow=nrow,
test_noise=test_noise,
)
self._store_loss_maps()
self._store_metric_maps()
self.optimizer_names.append(opt_name)
model_params = getattr(self, key).parameters()
if "args" in opt:
setattr(self, opt_name, (opt["name"](model_params, **opt["args"])))
else:
setattr(self, opt_name, (opt["name"](model_params)))
if "scheduler" in opt:
sched = opt["scheduler"]
if "args" in sched:
self.schedulers.append(
sched["name"](getattr(self, opt_name), **sched["args"])
)
else:
self.schedulers.append(sched["name"](getattr(self, opt_name)))
self.logger = Logger(
self,
losses_list,
metrics_list,
log_dir=log_dir,
nrow=nrow,
test_noise=test_noise,
)
self._store_loss_maps()
self._store_metric_maps()