(tree, ignore_nones=True)
return [flat for flat in flattened if (not ignore_nones) or flat is not None]
Gets the leaves of a tree.
Gets the leaves of a tree.
Gets the leaves of a tree .
def tree_leaves(tree, ignore_nones=True):
  """Gets the leaves of a tree."""

  # Right now this is just `tree_flatten`, but we keep this separate since
  # JAX's tree_flatten returns the structure of the tree as well.
  flattened = tree_flatten(tree)
  return [flat for flat in flattened if (not ignore_nones) or flat is not None]
def tree_leaves ( tree , ignore_nones = True ) : # Right now this is just `tree_flatten`, but we keep this separate since # JAX's tree_flatten returns the structure of the tree as well. flattened = tree_flatten ( tree ) return [ flat for flat in flattened if ( not ignore_nones ) or flat is not None ]