parameters: ()
return_statement: return saver
docstring: Returns the saver from SAVERS collection, or creates a default one.
  
    This method is used by other members of the training module, such as
    `Scaffold`, or `CheckpointSaverHook`.
  
    Returns:
      `Saver`.
  
    Raises:
      RuntimeError: If the SAVERS collection already has more than one items.
docstring_summary: Returns the saver from SAVERS collection, or creates a default one.
docstring_tokens: Returns the saver from SAVERS collection or creates a default one .
function: def _get_saver_or_default():
    """Returns the saver from SAVERS collection, or creates a default one.
  
    This method is used by other members of the training module, such as
    `Scaffold`, or `CheckpointSaverHook`.
  
    Returns:
      `Saver`.
  
    Raises:
      RuntimeError: If the SAVERS collection already has more than one items.
    """
    collection_key = ops.GraphKeys.SAVERS
    savers = ops.get_collection(collection_key)
    if savers:
      if len(savers) > 1:
        raise RuntimeError(
            "More than one item in collection {}. "
            "Please indicate which one to use by passing it to the constructor."
            .format(collection_key))
      return savers[0]
    saver = Saver(sharded=True, allow_empty=True)
    if saver is not None:
      ops.add_to_collection(collection_key, saver)
    return saver
function_tokens: def _get_saver_or_default ( ) : collection_key = ops . GraphKeys . SAVERS savers = ops . get_collection ( collection_key ) if savers : if len ( savers ) > 1 : raise RuntimeError ( "More than one item in collection {}. " "Please indicate which one to use by passing it to the constructor." . format ( collection_key ) ) return savers [ 0 ] saver = Saver ( sharded = True , allow_empty = True ) if saver is not None : ops . add_to_collection ( collection_key , saver ) return saver