Skip to content

Commit 8db46f7

Browse files
committed
start fixing type instability
1 parent f679a96 commit 8db46f7

7 files changed

+22
-22
lines changed

src/conditional_layers/conditional_layer_glow.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ or
5858
5959
See also: [`Conv1x1`](@ref), [`ResidualBlock`](@ref), [`get_params`](@ref), [`clear_grad!`](@ref)
6060
"""
61-
struct ConditionalLayerGlow <: NeuralNetLayer
62-
C::Conv1x1
61+
struct ConditionalLayerGlow{AF,Conv} <: NeuralNetLayer
62+
C::Conv
6363
RB::ResidualBlock
6464
logdet::Bool
65-
activation::ActivationFunction
65+
activation::AF
6666
end
6767

6868
@Flux.functor ConditionalLayerGlow

src/layers/invertible_layer_actnorm.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ export ActNorm, reset!
3939
4040
See also: [`get_params`](@ref), [`clear_grad!`](@ref)
4141
"""
42-
mutable struct ActNorm <: NeuralNetLayer
43-
k::Integer
44-
s::Parameter
45-
b::Parameter
42+
mutable struct ActNorm{P1,P2,I<:Integer} <: NeuralNetLayer
43+
k::I
44+
s::P1
45+
b::P2
4646
logdet::Bool
4747
is_reversed::Bool
4848
end

src/layers/invertible_layer_basic.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ or
5858
5959
See also: [`ResidualBlock`](@ref), [`get_params`](@ref), [`clear_grad!`](@ref)
6060
"""
61-
mutable struct CouplingLayerBasic <: NeuralNetLayer
61+
mutable struct CouplingLayerBasic{AF} <: NeuralNetLayer
6262
RB::Union{ResidualBlock, FluxBlock}
6363
logdet::Bool
64-
activation::ActivationFunction
64+
activation::AF
6565
is_reversed::Bool
6666
end
6767

src/layers/invertible_layer_conv1x1.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ export Conv1x1
3939
4040
See also: [`get_params`](@ref), [`clear_grad!`](@ref)
4141
"""
42-
struct Conv1x1 <: NeuralNetLayer
43-
k::Integer
44-
v1::Parameter
45-
v2::Parameter
46-
v3::Parameter
42+
struct Conv1x1{P1,P2,P3,I<:Integer} <: NeuralNetLayer
43+
k::I
44+
v1::P1
45+
v2::P2
46+
v3::P3
4747
logdet::Bool
4848
freeze::Bool
4949
end

src/layers/invertible_layer_glow.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ or
6060
6161
See also: [`Conv1x1`](@ref), [`ResidualBlock`](@ref), [`get_params`](@ref), [`clear_grad!`](@ref)
6262
"""
63-
struct CouplingLayerGlow <: NeuralNetLayer
64-
C::Conv1x1
63+
struct CouplingLayerGlow{Conv<:Conv1x1} <: NeuralNetLayer
64+
C::Conv
6565
RB::Union{ResidualBlock, FluxBlock}
6666
logdet::Bool
6767
activation::ActivationFunction

src/networks/invertible_network_conditional_glow.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ export NetworkConditionalGlow, NetworkConditionalGlow3D
5959
6060
See also: [`ActNorm`](@ref), [`CouplingLayerGlow!`](@ref), [`get_params`](@ref), [`clear_grad!`](@ref)
6161
"""
62-
struct NetworkConditionalGlow <: InvertibleNetwork
63-
AN::AbstractArray{ActNorm, 2}
64-
AN_C::ActNorm
62+
struct NetworkConditionalGlow{AN} <: InvertibleNetwork
63+
AN::AbstractArray{AN, 2}
64+
AN_C::AN
6565
CL::AbstractArray{ConditionalLayerGlow, 2}
6666
Z_dims::Union{Array{Array, 1}, Nothing}
6767
L::Int64

src/utils/dimensionality_operations.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ export ShuffleLayer, WaveletLayer, HaarLayer
99
###############################################################################
1010
# Custom type for squeezer functions
1111

12-
struct Squeezer
13-
forward::Function
14-
inverse::Function
12+
struct Squeezer{F1,F2}
13+
forward::F1
14+
inverse::F2
1515
end
1616

1717
function ShuffleLayer(;pattern="checkerboard")

0 commit comments

Comments
 (0)