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

Add extract-id implementations for all types #183

Merged
merged 4 commits into from
Aug 12, 2024
Merged

Conversation

sritchie
Copy link
Member

@sritchie sritchie commented Aug 8, 2024

  • Add extract-id implementations for all types #183:

    • adds emmy.{autodiff, tape} to emmy.sci's exported namespace set

    • adds emmy.dual/extract-id implementations for all supported output types
      (every type that already implements emmy.dual/IPerturbed)

    • moves emmy.tape/Completed to emmy.dual/Completed; it doesn't really make
      sense there, but this is the only current way to remove the circular
      dependency between emmy.dual and emmy.tape. (tape needs a dual
      import to gain emmy.dual/IPerturbed.)

    • simplifies the emmy.tape/gradient implementation down to only handle
      single real-or-structural arguments, just like emmy.dual/derivative. We'll
      share the "handle-multiple-input" implementation between the two in a
      follow-up PR

    • makes the tests in emmy.calculus.derivative generic on the derivative
      implementation, so we can run all tests in forward and reverse mode.

Copy link

codecov bot commented Aug 8, 2024

Codecov Report

Attention: Patch coverage is 62.74510% with 19 lines in your changes missing coverage. Please review.

Project coverage is 87.64%. Comparing base (8fb417f) to head (36d115c).

Files Patch % Lines
src/emmy/collection.cljc 11.11% 5 Missing and 3 partials ⚠️
src/emmy/quaternion.cljc 57.14% 6 Missing ⚠️
src/emmy/tape.cljc 83.33% 1 Missing and 1 partial ⚠️
src/emmy/matrix.cljc 0.00% 1 Missing ⚠️
src/emmy/polynomial.cljc 0.00% 1 Missing ⚠️
src/emmy/series.cljc 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #183      +/-   ##
==========================================
- Coverage   87.71%   87.64%   -0.07%     
==========================================
  Files         100      100              
  Lines       15807    15778      -29     
  Branches      844      845       +1     
==========================================
- Hits        13865    13829      -36     
- Misses       1098     1104       +6     
- Partials      844      845       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

d/IPerturbed
(replace-tag [v old new] (mapv #(d/replace-tag % old new) v))
(extract-tangent [v tag mode] (mapv #(d/extract-tangent % tag mode) v)))
(extract-tangent [v tag mode] (mapv #(d/extract-tangent % tag mode) v))
(extract-id [v id] (mapv #(d/extract-id % id) v)))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests will get hit when I enable gradients in the next PR.

@sritchie sritchie merged commit d4c4c07 into main Aug 12, 2024
4 of 6 checks passed
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