Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinuzziFrancesco committed Nov 10, 2024
1 parent 656dd4d commit 68c6561
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 49 deletions.
76 changes: 38 additions & 38 deletions src/mut_cell.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ end
Flux.@layer MUT1Cell

"""
MUT1Cell((in, out)::Pair;
kernel_init = glorot_uniform,
recurrent_kernel_init = glorot_uniform,
MUT1Cell((input_size => hidden_size);
init_kernel = glorot_uniform,
init_recurrent_kernel = glorot_uniform,
bias = true)
"""
function MUT1Cell((in, out)::Pair;
kernel_init = glorot_uniform,
recurrent_kernel_init = glorot_uniform,
bias = true)
function MUT1Cell((input_size, hidden_size)::Pair;
init_kernel = glorot_uniform,
init_recurrent_kernel = glorot_uniform,
bias::Bool = true)

Wi = kernel_init(out * 3, in)
Wh = recurrent_kernel_init(out * 2, out)
b = create_bias(Wi, bias, 3 * out)
Wi = init_kernel(hidden_size * 3, input_size)
Wh = init_recurrent_kernel(hidden_size * 2, hidden_size)
b = create_bias(Wi, bias, 3 * hidden_size)

return MUT1Cell(Wi, Wh, b)
end
Expand Down Expand Up @@ -56,10 +56,10 @@ end
Flux.@layer :expand MUT1

"""
MUT1((in, out)::Pair; kwargs...)
MUT1((input_size => hidden_size); kwargs...)
"""
function MUT1((in, out)::Pair; kwargs...)
cell = MUT1Cell(in => out; kwargs...)
function MUT1((input_size, hidden_size)::Pair; kwargs...)
cell = MUT1Cell(input_size => hidden_size; kwargs...)
return MUT1(cell)
end

Expand Down Expand Up @@ -89,19 +89,19 @@ end
Flux.@layer MUT2Cell

"""
MUT2Cell((in, out)::Pair;
kernel_init = glorot_uniform,
recurrent_kernel_init = glorot_uniform,
MUT2Cell((input_size => hidden_size);
init_kernel = glorot_uniform,
init_recurrent_kernel = glorot_uniform,
bias = true)
"""
function MUT2Cell((in, out)::Pair;
kernel_init = glorot_uniform,
recurrent_kernel_init = glorot_uniform,
bias = true)
function MUT2Cell((input_size, hidden_size)::Pair;
init_kernel = glorot_uniform,
init_recurrent_kernel = glorot_uniform,
bias::Bool = true)

Wi = kernel_init(out * 3, in)
Wh = recurrent_kernel_init(out * 3, out)
b = create_bias(Wi, bias, 3 * out)
Wi = init_kernel(hidden_size * 3, input_size)
Wh = init_recurrent_kernel(hidden_size * 3, hidden_size)
b = create_bias(Wi, bias, 3 * hidden_size)

return MUT2Cell(Wi, Wh, b)
end
Expand Down Expand Up @@ -137,10 +137,10 @@ end
Flux.@layer :expand MUT2

"""
MUT1Cell((in, out)::Pair; kwargs...)
MUT2Cell((input_size => hidden_size); kwargs...)
"""
function MUT2((in, out)::Pair; kwargs...)
cell = MUT2Cell(in => out; kwargs...)
function MUT2((input_size, hidden_size)::Pair; kwargs...)
cell = MUT2Cell(input_size => hidden_size; kwargs...)
return MUT2(cell)
end

Expand Down Expand Up @@ -169,19 +169,19 @@ end
Flux.@layer MUT3Cell

"""
MUT3Cell((in, out)::Pair;
kernel_init = glorot_uniform,
recurrent_kernel_init = glorot_uniform,
MUT3Cell((input_size => hidden_size);
init_kernel = glorot_uniform,
init_recurrent_kernel = glorot_uniform,
bias = true)
"""
function MUT3Cell((in, out)::Pair;
kernel_init = glorot_uniform,
recurrent_kernel_init = glorot_uniform,
function MUT3Cell((input_size, hidden_size)::Pair;
init_kernel = glorot_uniform,
init_recurrent_kernel = glorot_uniform,
bias = true)

Wi = kernel_init(out * 3, in)
Wh = recurrent_kernel_init(out * 3, out)
b = create_bias(Wi, bias, 3 * out)
Wi = init_kernel(hidden_size * 3, input_size)
Wh = init_recurrent_kernel(hidden_size * 3, hidden_size)
b = create_bias(Wi, bias, 3 * hidden_size)

return MUT3Cell(Wi, Wh, b)
end
Expand Down Expand Up @@ -215,10 +215,10 @@ end
Flux.@layer :expand MUT3

"""
MUT3((in, out)::Pair; kwargs...)
MUT3((input_size => hidden_size); kwargs...)
"""
function MUT3((in, out)::Pair; kwargs...)
cell = MUT3Cell(in => out; kwargs...)
function MUT3((input_size, hidden_size)::Pair; kwargs...)
cell = MUT3Cell(input_size => hidden_size; kwargs...)
return MUT3(cell)
end

Expand Down
22 changes: 11 additions & 11 deletions src/nas_cell.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ end
Flux.@layer NASCell

"""
NASCell((in, out)::Pair;
kernel_init = glorot_uniform,
recurrent_kernel_init = glorot_uniform,
NASCell((input_size => hidden_size);
init_kernel = glorot_uniform,
init_recurrent_kernel = glorot_uniform,
bias = true)
"""
function NASCell((in, out)::Pair;
kernel_init = glorot_uniform,
recurrent_kernel_init = glorot_uniform,
function NASCell((input_size, hidden_size)::Pair;
init_kernel = glorot_uniform,
init_recurrent_kernel = glorot_uniform,
bias = true)
Wi = kernel_init(8 * out, in)
Wh = recurrent_kernel_init(8 * out, out)
Wi = init_kernel(8 * hidden_size, input_size)
Wh = init_recurrent_kernel(8 * hidden_size, hidden_size)
b = create_bias(Wi, bias, size(Wh, 1))
return NASCell(Wi, Wh, b)
end
Expand Down Expand Up @@ -100,10 +100,10 @@ end
Flux.@layer :expand NAS

"""
NAS((in, out)::Pair; kwargs...)
NAS((input_size => hidden_size)::Pair; kwargs...)
"""
function NAS((in, out)::Pair; kwargs...)
cell = NASCell(in => out; kwargs...)
function NAS((input_size, hidden_size)::Pair; kwargs...)
cell = NASCell(input_size => hidden_size; kwargs...)
return NAS(cell)
end

Expand Down

0 comments on commit 68c6561

Please sign in to comment.