Created
August 14, 2018 17:32
-
-
Save George3d6/3780a700ea603b6ed4f0274f9f441e4a 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
#original code: https://github.com/ekinakyurek/GAN-70-Lines-of-Julia/blob/66a60a6ea4532841ee647f08759ae9b1ace0c892/gan.jl#L42 | |
function train_model(πͺ, data, π, optim) | |
gloss=dloss=counter=0.0; | |
B = | |
for generation=1:π[:epochs] | |
for n=1:32:(length(data[1,1,1,:]) - 33) | |
x = data[:,:,:,n:n+31] | |
Gz = G(πͺ[1],π©(π[:ginp],π[:batchsize])) | |
update!(πͺ[2], βd(πͺ[2],x,Gz), optim[2]) | |
z=π©(π[:ginp],2*π[:batchsize]) | |
update!(πͺ[1], βg(πͺ[1], πͺ[2], z), optim[1]) | |
end | |
# Compute the total losses, log them and save some images | |
log_model(πͺ, data, π, generation) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment