Skip to content

Conversation

@devmotion
Copy link
Member

Fixes #769 by adding and using a new valtype(::Type{T}, x) that returns typeof(value(T, x)).

The PR builds on #768 since the tests of valtype(::Type{T}, x) require the use of tag types (not instances as on master).

Copy link
Member

@andreasnoack andreasnoack left a comment

Choose a reason for hiding this comment

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

The change here seems right to me, and it fixes a world bug that showed up when differentiating through an ODE. The actual change is very small, and there is good test coverage.

@devmotion devmotion merged commit 463e830 into master Sep 12, 2025
10 of 11 checks passed
devmotion added a commit that referenced this pull request Sep 12, 2025
* Fix gradient and Jacobian for functions with `Dual` output

* Bump version from 1.2.0 to 1.2.1
devmotion added a commit that referenced this pull request Sep 12, 2025
* Fix gradient and Jacobian for functions with `Dual` output

* Bump version from 1.2.0 to 1.2.1
@devmotion devmotion deleted the dw/valtype branch September 12, 2025 14:25
devmotion added a commit that referenced this pull request Sep 12, 2025
* Fix gradient and Jacobian for functions with `Dual` output

* Bump version from 1.2.0 to 1.2.1
devmotion added a commit that referenced this pull request Sep 14, 2025
* Bump actions/cache from 1 to 3 (#643)

Bumps [actions/cache](https://github.com/actions/cache) from 1 to 3.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v1...v3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix tests by using tag types instead of instances (#768)

* Fix gradient and Jacobian for functions with `Dual` output (#770)

* Fix gradient and Jacobian for functions with `Dual` output

* Bump version from 1.2.0 to 1.2.1

* Make tests compatible with Julia 1.0 and 1.6

* Bump version to 0.10.39

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

ForwardDiff.gradient and ForwardDiff.jacobian don't handle functions with ForwardDiff.Dual output correctly

3 participants