feat(aggregation): Add Composition class and << operator - #776
powerofaisinstudy-debug wants to merge 2 commits into
Conversation
Overload __lshift__ operator to support composability syntax for chaining aggregators and matrix transformations.
|
@PierreQuinton Here is an initial implementation ready for review whenever you have time! Could you please add the |
|
Thanks for the PR. Could you adapt the code to match what is done in https://github.com/SimplexLab/TorchJD/blob/main/src/torchjd/autojac/_transform/_base.py ? Mainly:
|
|
@ValerianRey Can this be implemented using a hook? So basically, can a hook change the value of the input matrix, or is it just an observer? |
Yes. Also, this PR doesn't work because the output of the first aggregator in the composition will be a vector, not a matrix. We can't compose aggregators since their domains don't match. |
Summary
Closes #775.
This PR adds support for composability of aggregators and matrix transformations:
Compositioninsrc/torchjd/aggregation/composition.py.__lshift__operator inAggregator(src/torchjd/aggregation/_aggregator.py).tests/aggregation/test_composition.py.@PierreQuinton Here is an initial draft implementation ready for review whenever you have time!