Exported symbol σ too generic
- Dominant language
- Julia
- Stars
- 258
- Forks
- 138
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 3
Description
Currently NNlib exports σ, which in this package refers to the sigmoid function.
The name should be changed to "sigmoid" to avoid accidental usage in other code. For example the following code will silently use sigmoid (in this example instead of softmax) without raising an error:
```
julia> using Flux
struct MyOp{F, M<:AbstractMatrix}
v::M
σ::F
end
function (a::MyOp)(x::AbstractVecOrMat)
return σ(a.v * x)
end
a = MyOp(rand32(3,3), Flux.softmax);
x = rand32(3,3);
a(x)
julia> a(x) .- a.σ(a.v*x)
3×3 Matrix{Float32}:
0.513941 0.363848 0.456001
0.343419 0.281814 0.289344
0.519608 0.371748 0.457464
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating NNlib's export declaration and references to the exported symbol σ. Rename the symbol to sigmoid wherever it is exposed or used, then verify that σ is no longer exported and sigmoid provides the intended sigmoid function without the accidental-usage problem described in the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- machine-learning
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100