From 93d578105d95d626bbff864d10645f1b45ad4df4 Mon Sep 17 00:00:00 2001 From: MartinuzziFrancesco Date: Tue, 15 Oct 2024 10:57:21 +0200 Subject: [PATCH] weight init bugfix --- Project.toml | 2 +- src/ReservoirComputing.jl | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index aa2e21e6..98e01660 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ReservoirComputing" uuid = "7c2d2b1e-3dd4-11ea-355a-8f6a8116e294" authors = ["Francesco Martinuzzi"] -version = "0.10.2" +version = "0.10.3" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/src/ReservoirComputing.jl b/src/ReservoirComputing.jl index 23a9fbdc..5798dff3 100644 --- a/src/ReservoirComputing.jl +++ b/src/ReservoirComputing.jl @@ -67,6 +67,8 @@ function Predictive(prediction_data) Predictive(prediction_data, prediction_len) end +__partial_apply(fn, inp) = fn$inp + #fallbacks for initializers for initializer in (:rand_sparse, :delay_line, :delay_line_backward, :cycle_jumps, :simple_cycle, :pseudo_svd, @@ -83,13 +85,13 @@ for initializer in (:rand_sparse, :delay_line, :delay_line_backward, :cycle_jump return $initializer(WeightInitializers._default_rng(), T, dims...; kwargs...) end @eval function ($initializer)(rng::AbstractRNG; kwargs...) - return WeightInitializers.__partial_apply($initializer, (rng, (; kwargs...))) + return __partial_apply($initializer, (rng, (; kwargs...))) end @eval function ($initializer)(rng::AbstractRNG, ::Type{T}; kwargs...) where {T <: $NType} - return WeightInitializers.__partial_apply($initializer, ((rng, T), (; kwargs...))) + return __partial_apply($initializer, ((rng, T), (; kwargs...))) end - @eval ($initializer)(; kwargs...) = WeightInitializers.__partial_apply( + @eval ($initializer)(; kwargs...) = __partial_apply( $initializer, (; kwargs...)) end