StochasticAD.jl icon indicating copy to clipboard operation
StochasticAD.jl copied to clipboard

Add `ifelse`

Open mschauer opened this issue 2 years ago • 2 comments

Essentially, ifelse(c, x, y) == [x, y][1 + !c]

mschauer avatar Nov 30 '22 14:11 mschauer

Hi, it's been a while since this was posted but I'm curious if there's any update on this. Is this going to be the way to implement stochastically differentiable if statements, or is there eventually going to be a way to use standard if ... end syntax?

RickDW avatar Feb 04 '24 23:02 RickDW

Hey! Although I haven't gotten around to explicitly handling ifelse, there is a more powerful (experimental) StochasticAD.propagate function: see the branching example at https://gaurav-arya.github.io/StochasticAD.jl/stable/devdocs.html#via-StochasticAD.propagate

gaurav-arya avatar Feb 05 '24 02:02 gaurav-arya