Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ca8b1d5

Browse filesBrowse files
committed
change the scale to 1 if it's 0 to avoid ZeroDivisionErrors
1 parent 0593b1b commit ca8b1d5
Copy full SHA for ca8b1d5

File tree

1 file changed

+6
-1
lines changed
Filter options

1 file changed

+6
-1
lines changed

‎adaptive/learner/learnerND.py

Copy file name to clipboardExpand all lines: adaptive/learner/learnerND.py
+6-1
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,12 @@ def _recompute_all_losses(self):
513513
@property
514514
def _scale(self):
515515
# get the output scale
516-
return self._max_value - self._min_value
516+
scale = self._max_value - self._min_value
517+
if isinstance(scale, np.ndarray):
518+
scale[scale == 0] = 1
519+
elif scale == 0:
520+
scale = 1
521+
return scale
517522

518523
def _update_range(self, new_output):
519524
if self._min_value is None or self._max_value is None:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.