zfit / zfit-development

The developement repository for zfit with roadmaps, internal docs etc to clean up the issues
0 stars 2 forks source link

Backend independence and Python function wrapper #49

Open jonas-eschle opened 4 years ago

jonas-eschle commented 4 years ago

In order to be more independent of the backend and allow the API and workflow to be used more generally, we need the ability to use arbitrary Python code in the models/losses.

Strategy: we can create a @python_function decorator that guarantees that the function will be executed within python. Internally, we wrap it with @py_function + sugar (e.g. numerical grad?). To make sure the gradients work, we can do numerical computations of the gradients.

For the long term, we may use function dispatch or similar. But the guarantee to use arbitrary Python code should be there.

This allows to wrap black-box functions.