Skip to content

Conversation

@klamike
Copy link
Contributor

@klamike klamike commented Jul 2, 2025

This PR skips the grad/hess structure passes when the graphs evaluate to NaN, effectively marking them as having zero terms. I think this only happens when the constraint consists of only a parameter has no variables.

I'm not too confident in this fix, it might be better to adjust these methods instead:

ExaModels.jl/src/graph.jl

Lines 142 to 144 in bde7733

@inline (v::ParameterNode{I})(i, x, ::Nothing) where {I<:AbstractNode} = NaN
@inline (v::ParameterNode{I})(::Any, x, ::Nothing) where {I} = NaN
@inline (v::ParameterNode{I})(::Identity, x, ::Nothing) where {I<:AbstractNode} = NaN

But I'm not sure how. A related case is constraint(c, ::Int), which ends up calling _simdfunction(Null(), ...) but in that case AdjointNull is fine since it's a leaf node. Please advise 😄

@klamike klamike marked this pull request as draft July 2, 2025 22:29
@klamike klamike marked this pull request as ready for review July 2, 2025 23:41
@klamike klamike mentioned this pull request Jul 9, 2025
@sshin23 sshin23 merged commit 9040198 into exanauts:main Jul 28, 2025
7 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.

2 participants