Replace .copy() with list() in minimize.py
PiperOrigin-RevId: 631413376 Change-Id: I06dd3e3897078b57b0a0668b2182fa62dcd4a74e
This commit is contained in:
committed by
Copybara-Service
parent
4647f79c55
commit
8d896529f0
@@ -18,7 +18,7 @@ import abc
|
|||||||
import dataclasses
|
import dataclasses
|
||||||
import enum
|
import enum
|
||||||
import time
|
import time
|
||||||
from typing import Callable, List, Optional, TextIO, Tuple, Union
|
from typing import Callable, List, Optional, Sequence, TextIO, Tuple, Union
|
||||||
|
|
||||||
import mujoco
|
import mujoco
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -138,7 +138,7 @@ class Quadratic(Norm):
|
|||||||
def least_squares(
|
def least_squares(
|
||||||
x0: np.ndarray,
|
x0: np.ndarray,
|
||||||
residual: Callable[[np.ndarray], np.ndarray],
|
residual: Callable[[np.ndarray], np.ndarray],
|
||||||
bounds: Optional[List[np.ndarray]] = None,
|
bounds: Optional[Sequence[np.ndarray]] = None,
|
||||||
jacobian: Optional[Callable[[np.ndarray, np.ndarray], np.ndarray]] = None,
|
jacobian: Optional[Callable[[np.ndarray, np.ndarray], np.ndarray]] = None,
|
||||||
norm: Norm = Quadratic(),
|
norm: Norm = Quadratic(),
|
||||||
eps: float = 1e-6,
|
eps: float = 1e-6,
|
||||||
@@ -221,7 +221,7 @@ def least_squares(
|
|||||||
return mu, n_reduc
|
return mu, n_reduc
|
||||||
|
|
||||||
# Make local copy of bounds to avoid reshaping user input.
|
# Make local copy of bounds to avoid reshaping user input.
|
||||||
bounds = None if bounds is None else bounds.copy()
|
bounds = None if bounds is None else list(bounds)
|
||||||
if bounds is not None:
|
if bounds is not None:
|
||||||
# Checks bounds.
|
# Checks bounds.
|
||||||
if len(bounds) != 2:
|
if len(bounds) != 2:
|
||||||
|
|||||||
Reference in New Issue
Block a user