You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure whether this is intended or not, but when trying to specify the trainable parameters in the following code a "no method matching error" for the constructor is returned.
struct MyLayer{R, S, T}
a::R
b::S
c::T
end
Flux.@functor MyLayer (a,b)
m = MyLayer(Dense(1,10,tanh), Dense(1,10,tanh), zeros(5))
Flux.destructure(m) # returns no method matching error for the constructor
In the last sentence of the corresponding section in the documentation it is mentioned that a corresponding constructor has to exist. However, it is not clear to me how this constructor should look like.
The text was updated successfully, but these errors were encountered:
This issue seems to be the same as the one discussed in #3. You can check the comments therein for a solution to your problem: Instead of Flux.@functor MyLayer (a,b) you can define
function Functors.functor(::Type{<:MyLayer}, x)
functionreconstruct_MyLayer(xs)
returnMyLayer(xs.a, xs.b, x.c)
endreturn (a = x.a, b = x.b), reconstruct_MyLayer
end
I am not sure whether this is intended or not, but when trying to specify the trainable parameters in the following code a "no method matching error" for the constructor is returned.
In the last sentence of the corresponding section in the documentation it is mentioned that a corresponding constructor has to exist. However, it is not clear to me how this constructor should look like.
The text was updated successfully, but these errors were encountered: