Created
March 15, 2020 20:30
-
-
Save Roger-luo/17eec29fe45a09162542414fb186e68d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Flux | |
struct Linear{T, WT <: AbstractMatrix{T}, BT <: AbstractVector{T}} | |
W::WT | |
b::BT | |
end | |
Flux.functor(m::Linear) = (m.W, m.b), (W, b) -> Linear(W, b) | |
m = Linear(rand(2, 2), rand(2)) | |
params(m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment