diff --git a/Project.toml b/Project.toml index e9e8962..5b21751 100644 --- a/Project.toml +++ b/Project.toml @@ -31,8 +31,8 @@ ColorSchemes = "3" Distributions = "0.25" Flux = "0.14" Images = "0.25, 0.26" -POMDPTools = "0.1" -POMDPs = "0.9" +POMDPTools = "1" +POMDPs = "1" Parameters = "0.12" Plots = "1" Reexport = "1" @@ -43,4 +43,4 @@ ValueHistories = "0.5" WeightsAndBiasLogger = "0.5" Zygote = "0.6" cuDNN = "1" -julia = "1.6 - 1.10" +julia = "1.6 - 1.11" diff --git a/src/extras/spectral_normalization.jl b/src/extras/spectral_normalization.jl index e1acab7..7526612 100644 --- a/src/extras/spectral_normalization.jl +++ b/src/extras/spectral_normalization.jl @@ -1,13 +1,13 @@ # Power iteration algorithm for computing the spectral norm function power_iteration!(W, u, n_iterations) - v = nothing - for i=1:n_iterations - Wu = W' * u - v = Wu ./ (norm(Wu) + eps(Float32)) - Wv = W * v - u .= Wv ./ (norm(Wv) + eps(Float32)) - end - u, v + v = nothing + for i=1:n_iterations + Wu = W' * u + v = Wu ./ (norm(Wu) + eps(Float32)) + Wv = W * v + u .= Wv ./ (norm(Wv) + eps(Float32)) + end + u, v end # Compute the maximum singular value @@ -62,7 +62,7 @@ struct ConvSN{N,M,F,A,V, I<:Int, VV<:AbstractArray} u::VV # Left vector for power iteration end -function ConvSN(w::AbstractArray{T,N}, b::Union{Flux.Zeros, AbstractVector{T}}, σ = identity; +function ConvSN(w::AbstractArray{T,N}, b::Union{Bool, AbstractVector{T}}, σ = identity; stride = 1, pad = 0, dilation = 1, n_iterations = 1) where {T,N} stride = Flux.expand(Val(N-2), stride) dilation = Flux.expand(Val(N-2), dilation) @@ -73,7 +73,7 @@ end function ConvSN(k::NTuple{N,Integer}, ch::Pair{<:Integer,<:Integer}, σ = identity; init = Flux.glorot_uniform, stride = 1, pad = 0, dilation = 1, - weight = Flux.convfilter(k, ch, init = init), bias = Flux.zeros(ch[2]), n_iterations = 1) where N + weight = Flux.convfilter(k, ch, init = init), bias = false, n_iterations = 1) where N ConvSN(weight, bias, σ, stride = stride, pad = pad, dilation = dilation, n_iterations = n_iterations) end