Enhance typing of 'Model' and 'Vector' using 'typing.Generic'.
- Make `Vector` a `Generic[T]` to indicate that stored data arrays should have coherent types. - Make `Model` a `Generic[VectorT]` to indicate that a given model class is associated with a unique vector class. - In `Optimizer` and plug-ins ABCs, specify that inputs and outputs should be coherent using `Vector[T]` and `Model[Vector[T]]` type- hints. - In concrete plug-in classes, leave the existing code as-is so as not to make it harder to read.
parent
a748ae71
No related branches found
No related tags found
Showing
- declearn/model/api/_model.py 10 additions, 6 deletionsdeclearn/model/api/_model.py
- declearn/model/api/_vector.py 32 additions, 17 deletionsdeclearn/model/api/_vector.py
- declearn/model/sklearn/_np_vec.py 13 additions, 7 deletionsdeclearn/model/sklearn/_np_vec.py
- declearn/model/sklearn/_sgd.py 2 additions, 2 deletionsdeclearn/model/sklearn/_sgd.py
- declearn/model/tensorflow/_model.py 2 additions, 2 deletionsdeclearn/model/tensorflow/_model.py
- declearn/model/torch/_model.py 2 additions, 2 deletionsdeclearn/model/torch/_model.py
- declearn/optimizer/_base.py 12 additions, 6 deletionsdeclearn/optimizer/_base.py
- declearn/optimizer/modules/_api.py 6 additions, 3 deletionsdeclearn/optimizer/modules/_api.py
- declearn/optimizer/regularizers/_api.py 7 additions, 4 deletionsdeclearn/optimizer/regularizers/_api.py
Please register or sign in to comment