Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Nil doesn't understand SpecialFunctions functions #2588

Open
ToucheSir opened this issue Feb 6, 2025 · 2 comments
Open

Nil doesn't understand SpecialFunctions functions #2588

ToucheSir opened this issue Feb 6, 2025 · 2 comments

Comments

@ToucheSir
Copy link
Member

ToucheSir commented Feb 6, 2025

This breaks outputsize when a model uses any functions from that package. For example, FluxML/NNlib.jl#629 (comment). The easiest fix is to copy

for f in [:copy, :zero, :one, :oneunit,
:+, :-, :abs, :abs2, :inv,
:exp, :log, :log1p, :log2, :log10,
:sqrt, :tanh, :conj]
@eval Base.$f(::Nil) = nil
end
for one or more functions in SpecialFunctions, but I'm wondering if there's a better way.

@mcabbott
Copy link
Member

mcabbott commented Feb 7, 2025

For the immediate problem of gelu, Flux could simply add methods to all NNlib activation functions.

I don't remember quite why we decided against missing for this, maybe because it doesn't subtype Real? But it does obey erf(missing) === missing.

@ToucheSir
Copy link
Member Author

I don't remember either, but the Number subtype explanation makes sense.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants