create_function() and create_parametrized_function() know which backend they lambdify to, but do not record it. Estimators therefore need a redundant backend= argument that can silently mismatch the function's actual backend (e.g. NumPy reductions over JAX arrays, or a NotImplementedError from Estimator.gradient).
- Record the backend on the function objects created by
create_function(), create_parametrized_function(), and SympyDataTransformer.from_sympy().
- Formalize
.function, .argument_order, and .backend as a protocol, giving users a stable handle on the backend-native kernel (e.g. for jax.vmap/jax.hessian).
- Let estimators and
gradient_creator() infer the backend from the function; the explicit backend= argument stays as an override.
create_function()andcreate_parametrized_function()know which backend they lambdify to, but do not record it. Estimators therefore need a redundantbackend=argument that can silently mismatch the function's actual backend (e.g. NumPy reductions over JAX arrays, or aNotImplementedErrorfromEstimator.gradient).create_function(),create_parametrized_function(), andSympyDataTransformer.from_sympy()..function,.argument_order, and.backendas a protocol, giving users a stable handle on the backend-native kernel (e.g. forjax.vmap/jax.hessian).gradient_creator()infer the backend from the function; the explicitbackend=argument stays as an override.