Skip to content

Scalar parameters with constraints #987

Answered by jheek
ingmarschuster asked this question in Q&A
Discussion options

You must be logged in to vote

If you want to define the parameter and the constraint together, you could define a special type for it like:

Array = Any
class Constrained(flax.struct.PyTreeNode):
  value: Array
  constraint: SomeType

That would allow you to later recover the parameters with their constraints.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ingmarschuster
Comment options

@jheek
Comment options

@ingmarschuster
Comment options

Answer selected by ingmarschuster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants