-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
bugSomething isn't workingSomething isn't workingdiscussion requiredSome discussion necessary to decide how to address this issueSome discussion necessary to decide how to address this issue
Description
The comment on this line in scico.solver.minimize
Line 216 in 4eb21c1
| x0 = x0.ravel() # if x0 is a BlockArray it will become a jax array here |
is incorrect. This should be edited, and it should be confirmed that the functions does work for BlockArray input.
It's not clear whether the use of nonlocal and the "with side effects" is really necessary
Lines 233 to 250 in 4eb21c1
| def fun(x0): | |
| nonlocal res # To use the external res and update side effect | |
| res = spopt.minimize( | |
| min_func, | |
| x0=x0, | |
| args=args, | |
| jac=jac, | |
| method=method, | |
| options=options, | |
| ) # Returns OptimizeResult with x0 as ndarray | |
| return res.x.astype(x0_dtype) | |
| # HCB call with side effects to get the OptimizeResult on the same device it was called | |
| res.x = hcb.call( | |
| fun, | |
| arg=x0, | |
| result_shape=x0, # From Jax-docs: This can be an object that has .shape and .dtype attributes | |
| ) |
It would be worth confirming this or simplifying the code.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdiscussion requiredSome discussion necessary to decide how to address this issueSome discussion necessary to decide how to address this issue