How to use a global tape #121
-
The bash script below:
See the comments at the top of the script that describe the problem. my_script.sh
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The issue you are facing is that that variables in the vector 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 |
Beta Was this translation helpful? Give feedback.
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 callregisterInput
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 clearingstd::vector
does not deallocate memory, so the performance overhead is minimal.