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 Methods #25

Merged
merged 4 commits into from
Feb 22, 2022
Merged

Show Methods #25

merged 4 commits into from
Feb 22, 2022

Conversation

chriselrod
Copy link
Contributor

@chriselrod chriselrod commented Feb 21, 2022

Fixes #23
Example from the tests:

  x = rand(24,199);

  y = StrideArray{Float64}(undef, (static(2),size(x,2))) .= randn.() .* 10;
  sc = SimpleChain((Activation(abs2), TurboDense{true}(tanh, (static(24),static(8))), TurboDense{true}(identity, (static(8),static(2))), SquaredLoss(y)));

  @test sprint((io,t) -> show(io,t), sc) == """
SimpleChain with the following layers:
Activation layer applying: abs2
TurboDense (static(24), static(8)) with bias.
Activation layer applying: tanh
TurboDense (static(8), static(2)) with bias.
SquaredLoss"""

  @test first(Dropout(0.5)(x, pointer(x), pointer(sc.memory))) === x
  @test sum(iszero, x) == 0
  x .= rand.();

  scflp = FrontLastPenalty(sc, L2Penalty(2.3), L1Penalty(0.45));
  @test sprint((io,t) -> show(io,t), scflp) == """
Penalty on all but last layer: L2Penalty (λ=2.3)
Penalty on last layer: L1Penalty (λ=0.45) applied to:
SimpleChain with the following layers:
Activation layer applying: abs2
TurboDense (static(24), static(8)) with bias.
Activation layer applying: tanh
TurboDense (static(8), static(2)) with bias.
SquaredLoss"""

Copy link
Member

@korsbo korsbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@chriselrod chriselrod merged commit 503d8f6 into main Feb 22, 2022
@chriselrod chriselrod deleted the showmethods branch February 22, 2022 07:43
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 this pull request may close these issues.

Better show methods.
2 participants