Open yunlongxu-numagic opened 2 years ago
to ensure the model parameters are again set back to numpy types, we should create a test:
model_params.set_param(...)
modifies the parameters in the model where model_param comes from in place (probably already a dangerous behavior?! maybe should force the use of model.set_recursive_params
afterwards?)
model_params.replace_subtree(..)
does not modify the parameters used in the model in place!
TODO:
apply_and_forward_with_arrays
, during jax tracing or casadi code-gen, it will basically set the parameter of the model to the jax tracer or casadi symbolics, which are undesired artifacts, which we should ensure to set them back to the numeric values (otherwise when the user calls the model again, it won't work, but usually in OCP, the user doesn't call the model, only the jit or compiled function calls, so we don't see it)