Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show is confused by shared parameters #2321

Open
mcabbott opened this issue Aug 27, 2023 · 0 comments · May be fixed by #2335
Open

show is confused by shared parameters #2321

mcabbott opened this issue Aug 27, 2023 · 0 comments · May be fixed by #2335

Comments

@mcabbott
Copy link
Member

Here it concludes that there are non-trainable arrays, but in fact the same weights appear in two layers, which throws off the counting:

julia> using Flux

julia> let d = Dense(10 => 10)
       Chain(Embedding(10=>10), d, d)
       end
Chain(
  Embedding(10 => 10),                  # 100 parameters
  Dense(10 => 10),                      # 110 parameters
  Dense(10 => 10),                      # 110 parameters
)         # Total: 3 trainable arrays, 210 parameters,
          # plus 2 non-trainable, 110 parameters, summarysize 1.055 KiB.

julia> Flux.destructure(ans)  # length 210, correct
(Float32[1.7007293, 0.66258854, -0.040887665, -1.2084905, -0.53106576    0.0, 0.0, 0.0, 0.0, 0.0], Restructure(Chain, ..., 210))
@codetalker7 codetalker7 linked a pull request Sep 14, 2023 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant