|
22 | 22 | from optimagic.parameters.bounds import Bounds, get_internal_bounds, pre_process_bounds |
23 | 23 | from optimagic.parameters.tree_registry import ( |
24 | 24 | tree_flatten, |
25 | | - tree_just_flatten, |
| 25 | + tree_leaves, |
26 | 26 | tree_unflatten, |
27 | 27 | ) |
28 | | -from optimagic.parameters.tree_registry import tree_just_flatten as tree_leaves |
29 | 28 | from optimagic.typing import VALUE_NAMESPACE, BatchEvaluatorLiteral, PyTree |
30 | 29 |
|
31 | 30 |
|
@@ -226,18 +225,14 @@ def first_derivative( |
226 | 225 |
|
227 | 226 | if scaling_factor is not None and not np.isscalar(scaling_factor): |
228 | 227 | scaling_factor = np.array( |
229 | | - tree_just_flatten(scaling_factor, namespace=VALUE_NAMESPACE) |
| 228 | + tree_leaves(scaling_factor, namespace=VALUE_NAMESPACE) |
230 | 229 | ) |
231 | 230 |
|
232 | 231 | if min_steps is not None and not np.isscalar(min_steps): |
233 | | - min_steps = np.array( |
234 | | - tree_just_flatten(min_steps, namespace=VALUE_NAMESPACE) |
235 | | - ) |
| 232 | + min_steps = np.array(tree_leaves(min_steps, namespace=VALUE_NAMESPACE)) |
236 | 233 |
|
237 | 234 | if step_size is not None and not np.isscalar(step_size): |
238 | | - step_size = np.array( |
239 | | - tree_just_flatten(step_size, namespace=VALUE_NAMESPACE) |
240 | | - ) |
| 235 | + step_size = np.array(tree_leaves(step_size, namespace=VALUE_NAMESPACE)) |
241 | 236 | else: |
242 | 237 | x = params.astype(np.float64) |
243 | 238 |
|
@@ -544,18 +539,14 @@ def second_derivative( |
544 | 539 |
|
545 | 540 | if scaling_factor is not None and not np.isscalar(scaling_factor): |
546 | 541 | scaling_factor = np.array( |
547 | | - tree_just_flatten(scaling_factor, namespace=VALUE_NAMESPACE) |
| 542 | + tree_leaves(scaling_factor, namespace=VALUE_NAMESPACE) |
548 | 543 | ) |
549 | 544 |
|
550 | 545 | if min_steps is not None and not np.isscalar(min_steps): |
551 | | - min_steps = np.array( |
552 | | - tree_just_flatten(min_steps, namespace=VALUE_NAMESPACE) |
553 | | - ) |
| 546 | + min_steps = np.array(tree_leaves(min_steps, namespace=VALUE_NAMESPACE)) |
554 | 547 |
|
555 | 548 | if step_size is not None and not np.isscalar(step_size): |
556 | | - step_size = np.array( |
557 | | - tree_just_flatten(step_size, namespace=VALUE_NAMESPACE) |
558 | | - ) |
| 549 | + step_size = np.array(tree_leaves(step_size, namespace=VALUE_NAMESPACE)) |
559 | 550 | else: |
560 | 551 | x = params.astype(np.float64) |
561 | 552 |
|
|
0 commit comments