def _is_made_of_nones(obj):
  """Checks if `obj` is a nested structure of `None`s."""
  elems = tree_flatten(obj)
  # Returning False for an empty list, because it doesn't have any Nones inside.
  return elems and all(x is None for x in elems)
Checks if `obj` is a nested structure of `None`s.
trax/fastmath/numpy.py