Skip to content

Conversation

@avik-pal
Copy link
Member

@avik-pal avik-pal commented Mar 8, 2025

Reactant doesn't allow tracing conditionals directly right now. Add a hook rn to prevent reactant tracing.

src/interface.jl Outdated
Comment on lines 297 to 300
_assert_positive_eta(eta) = _assert_positive_eta(eta, eta < 0)
function _assert_positive_eta(eta, cond::Bool)
cond && throw(DomainError(eta, "the learning rate cannot be negative"))
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this function is being overloaded anyways, could the eta < 0 check not be moved inside _assert_positive_eta?

@ToucheSir
Copy link
Member

While I don't have any objections to this in principle, there are a couple of things to consider:

  1. This is being added as internal API, which means we can remove it in any release. Can Reactant deal with that?
  2. How many other places in the Optimisers.jl code need a similar change? If it's more than a handful, I think we need to step back and think about a more general solution (which may or may not live in Optimisers.jl itself).

@avik-pal
Copy link
Member Author

Added tests for the optimisers. We just need the assert check as a temporary means till we support throwing errors from inside MLIR

@avik-pal avik-pal changed the title fix: add a way to override eta check for reactant feat: reactant support Mar 28, 2025
@CarloLucibello CarloLucibello merged commit d9856bb into FluxML:master Mar 31, 2025
4 checks passed
@avik-pal avik-pal deleted the ap/fix_check branch March 31, 2025 19:37
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

Successfully merging this pull request may close these issues.

3 participants