Skip to content

split params and variables in .init() #1068

Answered by jheek
GJBoth asked this question in Ideas
Discussion options

You must be logged in to vote

Currently the easiest thing to split of the params is to call FrozenDict.pop:

variables = Model().init(...)
state, params = variables.pop("params")

That's pretty short and you can even just write the one-liner: Model().init(...).pop("params")

On a side note: We are thinking about patterns that avoid having to split the two in the first place. The main reason why you need this is because the optimizer holds the params and the user code holds the state.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@marcvanzee
Comment options

@GJBoth
Comment options

@marcvanzee
Comment options

@GJBoth
Comment options

Comment options

You must be logged in to vote
1 reply
@GJBoth
Comment options

Answer selected by marcvanzee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants