|
4 | 4 | from typing import Any, Literal, Sequence |
5 | 5 |
|
6 | 6 | import numpy as np |
7 | | -import optree |
8 | 7 | from numpy.typing import NDArray |
9 | 8 | from scipy.optimize import Bounds as ScipyBounds |
10 | 9 |
|
@@ -180,20 +179,17 @@ def _update_bounds_and_flatten( |
180 | 179 | np.ndarray: The updated and flattened bounds. |
181 | 180 |
|
182 | 181 | """ |
183 | | - with optree.dict_insertion_ordered(True, namespace=kind): |
184 | | - flat_nan_tree = tree_leaves(nan_tree, namespace=kind) |
| 182 | + flat_nan_tree = tree_leaves(nan_tree, namespace=kind) |
185 | 183 | if bounds is not None: |
186 | | - with optree.dict_insertion_ordered(True, namespace=VALUE_NAMESPACE): |
187 | | - flat_bounds = tree_leaves(bounds, namespace=VALUE_NAMESPACE) |
| 184 | + flat_bounds = tree_leaves(bounds, namespace=VALUE_NAMESPACE) |
188 | 185 |
|
189 | 186 | seperator = 10 * "$" |
190 | | - with optree.dict_insertion_ordered(True, namespace=VALUE_NAMESPACE): |
191 | | - params_names = leaf_names( |
192 | | - nan_tree, namespace=VALUE_NAMESPACE, separator=seperator |
193 | | - ) |
194 | | - bounds_names = leaf_names( |
195 | | - bounds, namespace=VALUE_NAMESPACE, separator=seperator |
196 | | - ) |
| 187 | + params_names = leaf_names( |
| 188 | + nan_tree, namespace=VALUE_NAMESPACE, separator=seperator |
| 189 | + ) |
| 190 | + bounds_names = leaf_names( |
| 191 | + bounds, namespace=VALUE_NAMESPACE, separator=seperator |
| 192 | + ) |
197 | 193 |
|
198 | 194 | flat_nan_dict = dict(zip(params_names, flat_nan_tree, strict=False)) |
199 | 195 |
|
|
0 commit comments