parameters: (var, primary_var, name)
return_statement: return tensor, [spec]
docstring: Return saveable spec for AUTO and ON_WRITE variables.
docstring_summary: Return saveable spec for AUTO and ON_WRITE variables.
docstring_tokens: Return saveable spec for AUTO and ON_WRITE variables .
function: def get_on_write_saveable(var, primary_var, name):
    """Return saveable spec for AUTO and ON_WRITE variables."""
    # We use a callable so that we don't have to evaluate this expression
    # in the case where we are trying to restore instead of save.
    def tensor():
      if context.executing_eagerly() and not primary_var.is_initialized():
        # A SaveSpec tensor value of `None` indicates that the variable is
        # uninitialized.
        return None
      strategy = var.distribute_strategy
      return strategy.extended.read_var(var)
  
    spec = saveable_object.SaveSpec(
        tensor=tensor,
        slice_spec="",
        name=name,
        dtype=var.dtype,
        device=primary_var.device)
  
    return tensor, [spec]
function_tokens: def get_on_write_saveable ( var , primary_var , name ) : # We use a callable so that we don't have to evaluate this expression # in the case where we are trying to restore instead of save. def tensor ( ) : if context . executing_eagerly ( ) and not primary_var . is_initialized ( ) : # A SaveSpec tensor value of `None` indicates that the variable is # uninitialized. return None strategy = var . distribute_strategy return strategy . extended . read_var ( var ) spec = saveable_object . SaveSpec ( tensor = tensor , slice_spec = "" , name = name , dtype = var . dtype , device = primary_var . device ) return tensor , [ spec ]