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

Remove greek-letter keyword arguments #2139

Merged
merged 5 commits into from
Apr 29, 2023
Merged

Conversation

mcabbott
Copy link
Member

The interface should be ascii. And especially should never require you to type ε not ϵ or the reverse.

@codecov-commenter
Copy link

codecov-commenter commented Dec 22, 2022

Codecov Report

Base: 86.48% // Head: 83.86% // Decreases project coverage by -2.62% ⚠️

Coverage data is based on head (7816ac7) compared to base (dc21964).
Patch coverage: 100.00% of modified lines in pull request are covered.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2139      +/-   ##
==========================================
- Coverage   86.48%   83.86%   -2.62%     
==========================================
  Files          19       19              
  Lines        1480     1500      +20     
==========================================
- Hits         1280     1258      -22     
- Misses        200      242      +42     
Impacted Files Coverage Δ
src/layers/normalise.jl 86.66% <100.00%> (-2.16%) ⬇️
src/losses/functions.jl 98.87% <100.00%> (+0.22%) ⬆️
src/losses/utils.jl 94.73% <100.00%> (+1.40%) ⬆️
src/cuda/cudnn.jl 0.00% <0.00%> (-90.91%) ⬇️
src/functor.jl 44.44% <0.00%> (-44.79%) ⬇️
src/layers/conv.jl 87.93% <0.00%> (-0.07%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -340,15 +342,17 @@ end
function BatchNorm(chs::Int, λ=identity;
initβ=zeros32, initγ=ones32,
Copy link
Member Author

Choose a reason for hiding this comment

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

This PR does not remove initβ, initγ. IMO they should be replaced with a method where you pass in a Scale layer. But perhaps better part of an overhaul of norm layers.

Getting rid of greek-letter field names may also be a good idea. The norm layers are the worst offenders.

Copy link
Member

Choose a reason for hiding this comment

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

We can tackle this as part of a bigger rework of norm layer internals to save on some churn.

@@ -88,8 +89,8 @@ y_dis[1,:], y_dis[2,:] = y_dis[2,:], y_dis[1,:]
@test crossentropy(ŷ, y_smoothed) ≈ lossvalue_smoothed
@test crossentropy(ylp, label_smoothing(yl, 2sf)) ≈ -sum(yls.*log.(ylp))
@test crossentropy(ylp, yl) ≈ -sum(yl.*log.(ylp))
@test iszero(crossentropy(y_same, ya, ϵ=0))
@test iszero(crossentropy(ya, ya, ϵ=0))
@test iszero(crossentropy(y_same, ya, ϵ=0)) # ε is deprecated
Copy link
Member

Choose a reason for hiding this comment

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

What's our stance on using @test_deprecated? I'm surprised there appear to be zero usages of it in Flux, perhaps this repo proceeds it?

@CarloLucibello
Copy link
Member

have there been actual complaints about non-ASCII characters?

@mcabbott
Copy link
Member Author

I thought this was a fairly standard complaint. Sometime a misguided one, when people assume that e.g. crossentropy(ŷ, y) has a non-ascii named argument.

Comment on lines 40 to 47
# Greek-letter keywords deprecated in Flux 0.13
# Arguments (old => new, :function, "β" => "beta")
function _greek_ascii_depwarn(βbeta::Pair, func = :loss, names = "" => "")
Base.depwarn("""loss function $func no longer accepts greek-letter keyword $(names.first)
please use ascii $(names.second) instead""", func)
βbeta.first
end
_greek_ascii_depwarn(βbeta::Pair{Nothing}, _...) = βbeta.second
Copy link
Member

Choose a reason for hiding this comment

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

Could this live outside of the Losses module?

Copy link
Member

Choose a reason for hiding this comment

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

We may want to make it non-differentiable as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

It could live somewhere else, but where? And is it worth it?

(Most uses are in Losses, I spotted the normalisation ones afterwards, just 3.)

Copy link
Member

Choose a reason for hiding this comment

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

utils.jl? That's included before any layers or loss functions are defined.

@@ -340,15 +342,17 @@ end
function BatchNorm(chs::Int, λ=identity;
initβ=zeros32, initγ=ones32,
Copy link
Member

Choose a reason for hiding this comment

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

We can tackle this as part of a bigger rework of norm layer internals to save on some churn.

Copy link
Member

@ToucheSir ToucheSir left a comment

Choose a reason for hiding this comment

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

I think we should look into using @test_deprecated for most of the deprecated functionality in Flux itself, but that can be a separate PR.

@mcabbott mcabbott merged commit d022b9f into FluxML:master Apr 29, 2023
@mcabbott mcabbott deleted the no_greek_kw branch April 29, 2023 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants