Skip to content

Instantly share code, notes, and snippets.

@George3d6
Created August 14, 2018 17:32
Show Gist options
  • Save George3d6/3780a700ea603b6ed4f0274f9f441e4a to your computer and use it in GitHub Desktop.
Save George3d6/3780a700ea603b6ed4f0274f9f441e4a to your computer and use it in GitHub Desktop.
#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