Skip to content

Instantly share code, notes, and snippets.

@George3d6
Created August 14, 2018 17:33
Show Gist options
  • Save George3d6/6b58aa69ec1e56e29e2337848116696b to your computer and use it in GitHub Desktop.
Save George3d6/6b58aa69ec1e56e29e2337848116696b to your computer and use it in GitHub Desktop.
function log_model(π—ͺ, data, πž—, generation)
println("Running logging function for generation $(generation)")
println("-----------------------------------------------------")
gloss=dloss=counter=0.0
for n=1:32:(length(data[1,1,1,:]) - 33)
x = data[:,:,:,n:n+31]
counter+=2*πž—[:batchsize]
Gz = G(π—ͺ[1],𝒩(πž—[:ginp],πž—[:batchsize]))
dloss += 2πž—[:batchsize]*𝑱d(π—ͺ[2],x,Gz)
z=𝒩(πž—[:ginp],2*πž—[:batchsize])
gloss += 2πž—[:batchsize]*𝑱g(π—ͺ[1],π—ͺ[2],z)
end
println("Generator average loss: $(gloss/counter)")
println("discriminator average loss: $(dloss/counter)")
generate_and_save(π—ͺ,6,πž—,generation)
println("Saved images for generation: $(generation)")
println("------------------------------------------------\n")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment