LouisDesdoigts / dLux

Differentiable optical models as parameterised neural networks in Jax using Zodiax
https://louisdesdoigts.github.io/dLux/
BSD 3-Clause "New" or "Revised" License
50 stars 6 forks source link

Function Pointers in Python #186

Closed Jordan-Dennis closed 1 year ago

Jordan-Dennis commented 1 year ago

Hi all, This is a personal reminder to investigate how to mimic a function pointer in python. I want to do this because it means that you can have more than one implementation of a function and then select which one to use based on some configuration (one can of course do this with if statements or first class functions) but I like function pointers. This ties in with #179, since it would allow us to have certain functions implemented for CPU and GPU differently. There are a few cases where this could be nice for example the hypotenuse function. Regards Jordan

Jordan-Dennis commented 1 year ago

First class functions will be way better I was just having a moment.