-
Notifications
You must be signed in to change notification settings - Fork 15
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
propagate
to add two stochastic triples together
#125
Comments
At quick glance, I think it's because you need |
Many thanks for the quick reply and catching that silly mistake on my end! However I don't think replacing using StochasticAD
function add(x, y)
x + y
end
function add(x::StochasticAD.StochasticTriple, y)
StochasticAD.propagate(add, x, y; keep_deltas=Val(true))
end
x = stochastic_triple(1)
y = 5
add(x, y) # 6 + 0ϵ
x + y # 6 + 1ϵ
add(x, y) == x + y # false |
Just a hunch: can you try writing |
Thanks, that does the trick! Any idea why the behavior for triples for floats is different than that for triples of ints? |
Well, an integer shouldn't really be able to possess continuous perturbations. But again, there definitely shouldn't be a silent error here, I need to fix that! |
Hello!
I'm trying to use the
propagate
function to extract derivatives from some Monte Carlo simulations. However, I noticed that the function does not behave as I would expect in even some simple use cases. A minimal example is given by simply adding two stochastic triples together:I expected that
propagate
would automatically ensure that this simple function would correctly propagate the perturbations but this does not seem to be the case. Am I doing something wrong or is this a bug?Thanks!
The text was updated successfully, but these errors were encountered: