Skip to content

Layers' docstrings and constructors inconsistencies #1422

Closed
@CarloLucibello

Description

@CarloLucibello

We have a pretty bad situation with the docstrings of Dense and Conv layers (and maybe others) not matching the corresponding method definitions.

In Conv's docstrings we have

Conv(filter, in => out, σ=identity; stride=1, pad=0, dilation=1)
Conv(weight::AbstractArray, bias, [activation; stride, pad, dilation])
Conv(; weight, bias, [activation, stride, pad, dilation])

not perfectly aligned with the actual definitions:

Conv(k::NTuple{N,Integer}, ch::Pair{<:Integer,<:Integer}, σ = identity;
            init = glorot_uniform,  stride = 1, pad = 0, dilation = 1,
            weight = convfilter(k, ch, init = init), bias = true)
Conv(w::AbstractArray{T,N}, b::Union{Bool, Zeros, AbstractVector{T}}, σ = identity;
              stride = 1, pad = 0, dilation = 1) where {T,N}
Conv(; weight::AbstractArray{T,N}, bias::Union{Bool, Zeros, AbstractVector{T}},
              activation = identity, stride = 1, pad = 0, dilation = 1) where {T,N}

The situation is even worse for Dense. The docstring contains only

Dense(in::Integer, out::Integer, σ = identity; bias=true)

while the actual constructors are

Dense(W, b)
Dense(in::Integer, out::Integer, σ = identity; initW=glorot_uniform, initb=zeros, bias=true)

We should also deprecate init in Conv and introduce initW and initb as in the Dense layer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions