Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composites: Cooperative LayerMapComposite #146

Merged
merged 3 commits into from
Jun 24, 2022

Conversation

chr5tphr
Copy link
Owner

@chr5tphr chr5tphr commented Jun 7, 2022

Composites: Cooperative LayerMapComposite

  • add the parameter layer_map to built-in subclasses of
    LayerMapComposite, which will be prepended to the composite's
    layer_map
  • add the parameter layer_map and first_map to built-in subclasses
    of SpecialFirstLayerMapComposite, which will be prepended to the
    composites layer_map and first_map respectively
  • this is done to let the user easily introduce small changes to the
    built-in composites, for example to add rules for missing layers, or
    change the behavior for existing modules
  • the most important use-case for this is adding a mapping for MaxPool layers
    to use another rule without the need to implement a full composite
  • for this use-case, also add the abstract type MaxPool

Tests: Cooperative LayerMapComposite

  • added tests for built-in cooperative LayerMapComposites
  • built-in composites now get cooperative variations for tests in
    conftest.py
  • these variations get custom rules PassClone and GradClone
  • the registered rule for each module is now checked only for the first
    match in the module_map, which would previously lead to errors when
    one module had more than one matching rule

Docs: Cooperative LayerMapComposite

  • add documentation for cooperative LayerMapComposite subtypes
  • add subsections to how-to/use-rules-composites-and-canonizers
    Composite

@chr5tphr chr5tphr force-pushed the cooperative-builtin-composites branch from e36aa94 to 7bfbb6f Compare June 7, 2022 20:57
@chr5tphr chr5tphr force-pushed the cooperative-builtin-composites branch from 7bfbb6f to 5254d32 Compare June 21, 2022 15:28
- add the parameter `layer_map` to built-in subclasses of
  LayerMapComposite, which will be prepended to the composite's
  `layer_map`
- add the parameter `layer_map` and `first_map` to built-in subclasses
  of SpecialFirstLayerMapComposite, which will be prepended to the
  composites `layer_map` and `first_map` respectively
- this is done to let the user easily introduce small changes to the
  built-in composites, for example to add rules for missing layers, or
  change the behavior for existing modules
- the most important use-case for this is adding a mapping for `MaxPool` layers
  to use another rule without the need to implement a full composite
- for this use-case, also add the abstract type `MaxPool`
- added tests for built-in cooperative LayerMapComposites
- built-in composites now get cooperative variations for tests in
  conftest.py
- these variations get custom rules `PassClone` and `GradClone`
- the registered rule for each module is now checked only for the first
  match in the module_map, which would previously lead to errors when
  one module had more than one matching rule
- add documentation for cooperative LayerMapComposite subtypes
- add subsections to how-to/use-rules-composites-and-canonizers
  Composite
@chr5tphr chr5tphr force-pushed the cooperative-builtin-composites branch from 6e0d0a1 to a728712 Compare June 24, 2022 09:52
@chr5tphr chr5tphr marked this pull request as ready for review June 24, 2022 12:29
@chr5tphr chr5tphr merged commit 5e32835 into master Jun 24, 2022
@chr5tphr chr5tphr deleted the cooperative-builtin-composites branch June 24, 2022 12:29
@chr5tphr chr5tphr changed the title Draft: Composites: Cooperative LayerMapComposite Composites: Cooperative LayerMapComposite Jun 24, 2022
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