@@ -180,7 +180,7 @@ def __init__(self):
180
180
self ._bounds_support_level = self .get_support_level ()["bounds" ]
181
181
self ._initial_point_support_level = self .get_support_level ()["initial_point" ]
182
182
self ._options = {}
183
- self ._max_evals_grouped = 1
183
+ self ._max_evals_grouped = None
184
184
185
185
@abstractmethod
186
186
def get_support_level (self ):
@@ -205,7 +205,7 @@ def set_options(self, **kwargs):
205
205
206
206
# pylint: disable=invalid-name
207
207
@staticmethod
208
- def gradient_num_diff (x_center , f , epsilon , max_evals_grouped = 1 ):
208
+ def gradient_num_diff (x_center , f , epsilon , max_evals_grouped = None ):
209
209
"""
210
210
We compute the gradient with the numeric differentiation in the parallel way,
211
211
around the point x_center.
@@ -214,11 +214,14 @@ def gradient_num_diff(x_center, f, epsilon, max_evals_grouped=1):
214
214
x_center (ndarray): point around which we compute the gradient
215
215
f (func): the function of which the gradient is to be computed.
216
216
epsilon (float): the epsilon used in the numeric differentiation.
217
- max_evals_grouped (int): max evals grouped
217
+ max_evals_grouped (int): max evals grouped, defaults to 1 (i.e. no batching).
218
218
Returns:
219
219
grad: the gradient computed
220
220
221
221
"""
222
+ if max_evals_grouped is None : # no batching by default
223
+ max_evals_grouped = 1
224
+
222
225
forig = f (* ((x_center ,)))
223
226
grad = []
224
227
ei = np .zeros ((len (x_center ),), float )
0 commit comments