Skip to content

Instantly share code, notes, and snippets.

@vnegi10
Last active August 6, 2023 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vnegi10/b4ea83e72f8b800fedbfdd2f65e7d301 to your computer and use it in GitHub Desktop.
Save vnegi10/b4ea83e72f8b800fedbfdd2f65e7d301 to your computer and use it in GitHub Desktop.
function update_model!(learn,
flux_model,
x_in,
y_in)
dLdm, _, _ = gradient(get_loss, flux_model, x_in, y_in)
@. flux_model.weight = flux_model.weight - Float32(learn * dLdm.weight)
@. flux_model.bias = flux_model.bias - Float32(learn * dLdm.bias)
return flux_model
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment