google-research / data-driven-advection

Apache License 2.0
185 stars 56 forks source link

explicit time dependence #5

Open yohai opened 5 years ago

yohai commented 5 years ago

https://github.com/googleprivate/pde-superresolution-2d/blob/6981ff1ee8a1bc99275d34d5f835213d02b174f8/pde_superresolution_2d/core/equations.py#L159-L161 @shoyer @JiaweiZhuang I think we might want to change the signature of equation.time_derivative to include the time:

 def time_derivative( 
     self, time, grid: grids.Grid, **inputs: tf.Tensor 
 ) -> Dict[str, tf.Tensor]:

For cases where the equation depends explicitly on time (e.g time-dependent forcing)

shoyer commented 5 years ago

Yes, indeed. The other option would be to put "time" as a variable in **inputs. I'll need to think about this a little more...

yohai commented 5 years ago

I considered that, but I think this is more natural since time is a very generic parameter. It also follows the logic of odeint of scipy and the such (ode45 of MATLAB etc). Also, if grid (which is space) is special enough to be a mandatory named argument then time should also be.