Skip to content
Discussion options

You must be logged in to vote

The issue you are facing is that that variables in the vector ax keep their tape slot information after the tape is cleared. When you call registerInput for an active variable, it assigns a tape slot for it and stores it. This information is not cleared when you clear the tape, and re-assigning the value does not change the tape registration slot.

To fix your issue, you should clear your vector of inputs when you clear the tape and re-create the AD variables. Then it will work for any M. Note that clearing std::vector does not deallocate memory, so the performance overhead is minimal.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by auto-differentiation-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants