Skip to content

Commit 07b16dc

Browse files
committed
resolve comments
1 parent ef979fc commit 07b16dc

File tree

5 files changed

+12
-17
lines changed

5 files changed

+12
-17
lines changed

FastTimeSeries/Project.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54"
1313
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1414
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1515
UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
16-
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
1716

1817
[compat]
1918
DataDeps = "0.7"
@@ -23,5 +22,4 @@ Flux = "0.12, 0.13"
2322
InlineTest = "0.2"
2423
MLUtils = "0.2"
2524
UnicodePlots = "2, 3"
26-
julia = "1.6"
27-
Zygote = "0.6"
25+
julia = "1.6"

FastTimeSeries/src/models.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ function blockmodel(inblock::TimeSeriesRow,
99
backbone)
1010
#TODO: Use Flux.outputsize here.
1111
data = rand(Float32, inblock.nfeatures, 32, inblock.obslength)
12-
# data = [rand(Float32, inblock.nfeatures, 32) for _ ∈ 1:inblock.obslength]
1312
output = backbone(data)
1413
return Models.RNNModel(backbone, outsize = length(outblock.classes), recout = size(output, 1))
1514
end
@@ -25,4 +24,6 @@ end
2524

2625
# ## Tests
2726

28-
@testset "blockbackbone" begin @test_nowarn FastAI.blockbackbone(TimeSeriesRow(1,140)) end
27+
@testset "blockbackbone" begin
28+
@test_nowarn FastAI.blockbackbone(TimeSeriesRow(1,140))
29+
end

FastTimeSeries/src/models/InceptionTime.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ function InceptionBlock(ni::Int, nf::Int = 32, residual::Bool = true, depth::Int
6565

6666
end
6767

68-
function changedims(X)
69-
X = permutedims(X, (2, 1, 3))
70-
return X
71-
end
68+
changedims(X) = permutedims(X, (2, 1, 3))
7269

7370
"""
7471
InceptionTime(c_in::Int, c_out::Int, seq_len = nothing, nf::Int = 32)

FastTimeSeries/src/models/RNN.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
function tabular2rnn(X::AbstractArray{Float32, 3})
2-
X = permutedims(X, (1, 3, 2))
3-
return X
4-
end
1+
tabular2rnn(X::AbstractArray{<:AbstractFloat, 3}) = permutedims(X, (1, 3, 2))
52

63
struct RNNModel{A, B}
74
recbackbone::A
@@ -32,6 +29,9 @@ end
3229
function (m::RNNModel)(X)
3330
X = tabular2rnn(X)
3431
Flux.reset!(m.recbackbone)
32+
# ChainRulesCore.ignore_derivatives() do
33+
# Flux.reset!(m.recbackbone)
34+
# end
3535
X = m.recbackbone(X)[:, :, end]
3636
return m.finalclassifier(X)
3737
end

FastTimeSeries/src/models/layers.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,17 @@ of the layers.
2121
function StackedLSTM(in::Int, out::Integer, hiddensize::Integer, layers::Integer;
2222
init=Flux.glorot_uniform)
2323
if layers == 1
24-
chain = Chain(LSTM(in, out; init=init))
24+
return Chain(LSTM(in, out; init=init))
2525
elseif layers == 2
26-
chain = Chain(LSTM(in, hiddensize; init=init),
26+
return Chain(LSTM(in, hiddensize; init=init),
2727
LSTM(hiddensize, out; init=init))
2828
else
2929
chain_vec = [LSTM(in, hiddensize; init=init)]
3030
for i = 1:layers - 2
3131
push!(chain_vec, LSTM(hiddensize, hiddensize; init=init))
3232
end
33-
chain = Chain(chain_vec..., LSTM(hiddensize, out; init=init))
33+
return Chain(chain_vec..., LSTM(hiddensize, out; init=init))
3434
end
35-
return chain
3635
end
3736

3837
function Conv1d(ni, nf, ks; stride = 1, padding = Flux.SamePad, dilation = 1, bias = true)

0 commit comments

Comments
 (0)