Skip to content

Commit

Permalink
final fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinuzziFrancesco committed Nov 22, 2024
1 parent 9bfdf1e commit b6dd982
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/peepholelstm_cell.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function PeepholeLSTMCell(
end

function (lstm::PeepholeLSTMCell)(inp::AbstractVecOrMat)
state = zeros_like(lstm, size(lstm.Wh, 2))
state = zeros_like(inp, size(lstm.Wh, 2))
c_state = zeros_like(state)
return lstm(inp, (state, c_state))
end
Expand All @@ -75,7 +75,7 @@ function (lstm::PeepholeLSTMCell)(inp::AbstractVecOrMat,
g = lstm.Wi * inp .+ lstm.Wh * c_state .+ b
input, forget, cell, output = chunk(g, 4; dims = 1)
new_cstate = @. sigmoid_fast(forget) * c_state + sigmoid_fast(input) * tanh_fast(cell)
new_state = @. sigmoid_fast(output) * tanh_fast(c′)
new_state = @. sigmoid_fast(output) * tanh_fast(new_cstate)
return new_state, new_cstate
end

Expand Down

0 comments on commit b6dd982

Please sign in to comment.