Skip to content

Commit db0406d

Browse files
Add Base.firstindex(c::Chain) = 1
I see no reason not to have this, and I ran into missing it, as I have made a habit of indexing with `begin` as opposed to 1.
1 parent 6def768 commit db0406d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/layers/basic.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function Chain(; kw...)
4444
end
4545

4646
@forward Chain.layers Base.getindex, Base.length, Base.first, Base.last,
47-
Base.iterate, Base.lastindex, Base.keys
47+
Base.iterate, Base.lastindex, Base.keys, Base.firstindex
4848

4949
@functor Chain
5050

@@ -68,7 +68,7 @@ end
6868
Base.getindex(c::Chain, i::AbstractArray) = Chain(c.layers[i])
6969
Base.getindex(c::Chain{<:NamedTuple}, i::AbstractArray) =
7070
Chain(NamedTuple{Base.keys(c)[i]}(Tuple(c.layers)[i]))
71-
71+
Base.firstindex(c::Chain) = 1
7272
function Base.show(io::IO, c::Chain)
7373
print(io, "Chain(")
7474
_show_layers(io, c.layers)

0 commit comments

Comments
 (0)