Skip to content

Expose the computational backend on function objects #569

Description

@redeboer

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.

Metadata

Metadata

Assignees

Labels

⚙️ EnhancementImprovements and optimizations of existing features

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions