Skip to content

Commit

Permalink
remove last, fix test warning
Browse files Browse the repository at this point in the history
  • Loading branch information
lostella committed Mar 8, 2024
1 parent dd9f741 commit 17654b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
12 changes: 0 additions & 12 deletions src/itertools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@ repeatedly(f) = (f() for _ in Iterators.repeated(nothing))

repeatedly(f, n::Integer) = (f() for _ = 1:n)

function last(itr)
res = iterate(itr)
if res === nothing
throw(ArgumentError("iterator must be non-empty"))
end
output, state = res
for elem in Iterators.rest(itr, state)
output = elem
end
return output
end

mutable struct Settable{T}
v::T
end
Expand Down
18 changes: 9 additions & 9 deletions test/test_models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ using Serialization
using Statistics
using Test

struct CustomModel <: Model
m1::Any
act1::Any
m2::Any
act2::Any
end

(m::CustomModel)(x) = (m.act2 m.m2 m.act1 m.m1)(x)

@testset "Basic operations" begin
@testset "$(T)" for T in [Float16, Float32, Float64]
@testset "$(name)" for (name, m) in [
Expand Down Expand Up @@ -177,15 +186,6 @@ end
end

@testset "Custom ($(T))" for T in [Float32, Float64]
struct CustomModel <: Model
m1::Any
act1::Any
m2::Any
act2::Any
end

(m::CustomModel)(x) = (m.act2 m.m2 m.act1 m.m1)(x)

input_size, hidden_size, output_size = 1000, 50, 1
batch_size = 64

Expand Down

0 comments on commit 17654b6

Please sign in to comment.