Skip to content

Commit

Permalink
weight init bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinuzziFrancesco committed Oct 15, 2024
1 parent f9dd263 commit 93d5781
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 5 additions & 3 deletions src/ReservoirComputing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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

Expand Down

0 comments on commit 93d5781

Please sign in to comment.