Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
grad = nan_to_num(-1.0 * neg_grad)
grad = grad.astype(np.float64)
else:
self.previous_x = x
grad = None
if self.n_eval % 10 == 0:
self.update_progress_desc(neg_value, grad)
if self.n_eval > self.maxeval:
self.update_progress_desc(neg_value, grad)
raise StopIteration
self.n_eval += 1
if self.progressbar:
assert isinstance(self.progress, ProgressBar)
self.progress.update_bar(self.n_eval)
if self.use_gradient:
return value, grad
else:
return value