-
Notifications
You must be signed in to change notification settings - Fork 21
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
Summ net #82
Summ net #82
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #82 +/- ##
==========================================
+ Coverage 88.47% 88.52% +0.05%
==========================================
Files 33 34 +1
Lines 2577 2589 +12
==========================================
+ Hits 2280 2292 +12
Misses 297 297
☔ View full report in Codecov by Sentry. |
end | ||
|
||
@Flux.functor NetworkConditionalGlow | ||
|
||
# Constructor | ||
function NetworkConditionalGlow(n_in, n_cond, n_hidden, L, K;freeze_conv=false, split_scales=false, rb_activation::ActivationFunction=ReLUlayer(), k1=3, k2=1, p1=1, p2=0, s1=1, s2=1, ndims=2, squeezer::Squeezer=ShuffleLayer(), activation::ActivationFunction=SigmoidLayer()) | ||
function NetworkConditionalGlow(n_in, n_cond, n_hidden, L, K; freeze_conv=false, split_scales=false, summary_net = nothing, rb_activation::ActivationFunction=ReLUlayer(), k1=3, k2=1, p1=1, p2=0, s1=1, s2=1, ndims=2, squeezer::Squeezer=ShuffleLayer(), activation::ActivationFunction=SigmoidLayer()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this different than just the composition sumarry \odot G
?
The whole point of Chain/odot is to easily combine/chain networks and have it work well together, I don't particularly like having networks as input of another like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main difference is that composition is not defined for conditional networks.
Practically:
I don't think it will work without some extra work because only one of the inputs to G goes into summary.
(x,y) -> G(x, summary(y))
And summary isnt necessarily invertible so the backward needs to be provide the input to the summary for the gradient calculation (C_save here)
Zx, Zy, lgdet = G.forward(X, Y)
dx, x, dy = G.backward(Zx, Zx, Zy; C_save = Y)
So it will not play nicely with the composition operator that was built for invertible networks.
That said, I agree that it isnt pretty and if these things are easy to solve I am all for it.
How about something like this previous commit @mloubout ?
And the main operations are the same as before
|
First try at adding a summary network to conditional glow.
I could use some extra eyes on how to implement this cleanly. Although it gets the job done and works with arbitrary flux layers, it feel a little bit clunky.