Skip to content

WIP: GradOutHook, MergedComposite and multi-hooks#182

Draft
chr5tphr wants to merge 1 commit intomainfrom
multiple-hooks
Draft

WIP: GradOutHook, MergedComposite and multi-hooks#182
chr5tphr wants to merge 1 commit intomainfrom
multiple-hooks

Conversation

@chr5tphr
Copy link
Owner

  • support the use of multiple hooks by checking for tuples form Composites' module_map and registering all of them (multiple Hook instances only overwrite the results of another)
  • add HookBase as another layer of abstraction, above both Hook (which hooks over one full module) and GradOutHook (which hooks only the output of a function)
  • add GradOutHook, which can modify the gradient at the output of a module
  • add MultiComposite as a parent to MixedComposite
  • add MergedComposite, inheriting from MultiComposite, which merges rules returned from composites for a multi-hook setting rather than using the first hook that applies

Todo:

  • finish functionality
  • finish docstrings
  • extend documentation (How-To etc.)
  • write tests

- support the use of multiple hooks by checking for tuples form
  Composites' module_map and registering all of them (multiple Hook
  instances only overwrite the results of another)
- add HookBase as another layer of abstraction, above both Hook (which
  hooks over one full module) and GradOutHook (which hooks only the
  output of a function)
- add GradOutHook, which can modify the gradient at the output of a
  module
- add MultiComposite as a parent to MixedComposite
- add MergedComposite, inheriting from MultiComposite, which merges
  rules returned from composites for a multi-hook setting rather than
  using the first hook that applies

Todo:

- finish functionality
- finish docstrings
- extend documentation (How-To etc.)
- write tests
@chr5tphr chr5tphr force-pushed the main branch 4 times, most recently from 3fbdb43 to 6204e31 Compare July 31, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant