Skip to content
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

The alternative to ifelse #16

Closed
ChrisRackauckas opened this issue Jul 19, 2020 · 3 comments
Closed

The alternative to ifelse #16

ChrisRackauckas opened this issue Jul 19, 2020 · 3 comments

Comments

@ChrisRackauckas
Copy link
Member

ChrisRackauckas commented Jul 19, 2020

ifelse is a bit problematic for symbolic libraries because it's in Core and not in Base and dispatch cannot be added to it. So, while we want to represent branching, we need to do so without using ifelse. The opportunities are something like:

  • ModelingToolkit.ifelse
  • _ifelse (exported)
  • A different name

We need to just pick one and start using it, and whatever is chosen is what the eventual tracer should transform things to.

┆Issue is synchronized with this Trello card by Unito

@ChrisRackauckas
Copy link
Member Author

JuliaLang/julia#32844 hopefully this changes in Base.

ChrisRackauckas referenced this issue in SciML/ModelingToolkit.jl Sep 2, 2020
It's time we finally handle #531, https://github.com/SciML/ModelingToolkit.jl/issues/532, and https://discourse.julialang.org/t/differentiation-method-for-element-wise-abs-function-applied-on-operation-types-in-modelingtoolkit-jl/45867/4 . This PR creates a `ModelingToolkit.ifelse` with derivative fixes for `abs` to make it so standard conditional code can work. While tracing cannot correctly make these operations, this would at least allow directly written symbolic code to handle conditions, so we're at least as good (or bad) as TensorFlow.
@ChrisRackauckas ChrisRackauckas transferred this issue from SciML/ModelingToolkit.jl Feb 26, 2021
@ChrisRackauckas
Copy link
Member Author

The solution ended up being https://github.com/SciML/IfElse.jl

@devmotion
Copy link
Contributor

AFAICT this issue can be fixed since it was fixed upstream. Base.ifelse has been available since Julia 1.8.

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

No branches or pull requests

2 participants