Conversation
|
This PR adds:
What do you think @SarahAlidoost and @SCiarella ? I think this can simplify some expressions in the models - I imagine a lot of the |
|
Thanks @fnattino, this looks fantastic 🚀 I really like the template to automatically broadcast to the correct shape and device at the beginning, because right now we are doing it quite a lot of times in the integration loops. Ideally, it would be nice to remove all the calls to |
One thing is the naming "
It is Awesome! 🥇 Thanks. I like how things get simpler and cleaner. Just one comment about naming, see above. |
|
Thank you @SCiarella and @SarahAlidoost for the useful feedback!
Indeed, I think it's a good idea to also add similar containers for states and rates, so all variables are initialized with the correct shape and device!
My idea was to use import torch
from diffwofost.physical_models.base import TensorParamTemplate
from diffwofost.physical_models.traitlets import Tensor
class Parameters(TensorParamTemplate):
A = Tensor(0.)
B = Tensor(0, dtype=int)
# Parameters A and B are casted into tensors
params = Parameters(dict(A=0., B=0))
params.A
# tensor(0., dtype=torch.float64)
params.B
# tensor(0) |
|



relates #25