parameters: (self, names_to_variables)
return_statement: return vars_to_save
docstring: Returns the variables and names that will be used for a Saver.
  
      Args:
        names_to_variables: A dict (k, v) where k is the name of a variable and v
           is a Variable to save or a BaseSaverBuilder.Saver.
  
      Returns:
        A list of BaseSaverBuilder.VarToSave objects.
  
      Raises:
        TypeError: If any of the keys are not strings or any of the
          values are not one of Tensor or Variable.
        ValueError: If the same variable is given in more than one value
          (this also applies to slices of SlicedVariables).
docstring_summary: Returns the variables and names that will be used for a Saver.
docstring_tokens: Returns the variables and names that will be used for a Saver .
function: def _ValidateAndSliceInputs(self, names_to_variables):
      """Returns the variables and names that will be used for a Saver.
  
      Args:
        names_to_variables: A dict (k, v) where k is the name of a variable and v
           is a Variable to save or a BaseSaverBuilder.Saver.
  
      Returns:
        A list of BaseSaverBuilder.VarToSave objects.
  
      Raises:
        TypeError: If any of the keys are not strings or any of the
          values are not one of Tensor or Variable.
        ValueError: If the same variable is given in more than one value
          (this also applies to slices of SlicedVariables).
      """
      if not isinstance(names_to_variables, dict):
        names_to_variables = self._VarListToDict(names_to_variables)
  
      vars_to_save = []
      seen_variables = set()
      for name in sorted(names_to_variables.keys()):
        if not isinstance(name, six.string_types):
          raise TypeError("names_to_variables must be a dict mapping string "
                          "names to variable Tensors. Name is not a string: %s" %
                          name)
        v = names_to_variables[name]
        if isinstance(v, (list, tuple)):
          # A set of slices.
          slice_name = None
          # pylint: disable=protected-access
          for variable in v:
            if not isinstance(variable, variables.Variable):
              raise ValueError("Slices must all be Variables: %s" % variable)
            if not variable._save_slice_info:
              raise ValueError("Slices must all be slices: %s" % variable)
            if slice_name is None:
              slice_name = variable._save_slice_info.full_name
            elif slice_name != variable._save_slice_info.full_name:
              raise ValueError(
                  "Slices must all be from the same tensor: %s != %s"
                  % (slice_name, variable._save_slice_info.full_name))
            self._AddVarToSave(vars_to_save, seen_variables,
                               variable, variable._save_slice_info.spec, name)
          # pylint: enable=protected-access
        else:
          # A variable or tensor.
          variable = ops.convert_to_tensor(v, as_ref=True)
          if not self._IsVariable(variable):
            raise TypeError("names_to_variables must be a dict mapping string "
                            "names to Tensors/Variables. Not a variable: %s" %
                            variable)
          self._AddVarToSave(vars_to_save, seen_variables, variable, "", name)
      return vars_to_save
function_tokens: def _ValidateAndSliceInputs ( self , names_to_variables ) : if not isinstance ( names_to_variables , dict ) : names_to_variables = self . _VarListToDict ( names_to_variables ) vars_to_save = [ ] seen_variables = set ( ) for name in sorted ( names_to_variables . keys ( ) ) : if not isinstance ( name , six . string_types ) : raise TypeError ( "names_to_variables must be a dict mapping string " "names to variable Tensors. Name is not a string: %s" % name ) v = names_to_variables [ name ] if isinstance ( v , ( list , tuple ) ) : # A set of slices. slice_name = None # pylint: disable=protected-access for variable in v : if not isinstance ( variable , variables . Variable ) : raise ValueError ( "Slices must all be Variables: %s" % variable ) if not variable . _save_slice_info : raise ValueError ( "Slices must all be slices: %s" % variable ) if slice_name is None : slice_name = variable . _save_slice_info . full_name elif slice_name != variable . _save_slice_info . full_name : raise ValueError ( "Slices must all be from the same tensor: %s != %s" % ( slice_name , variable . _save_slice_info . full_name ) ) self . _AddVarToSave ( vars_to_save , seen_variables , variable , variable . _save_slice_info . spec , name ) # pylint: enable=protected-access else : # A variable or tensor. variable = ops . convert_to_tensor ( v , as_ref = True ) if not self . _IsVariable ( variable ) : raise TypeError ( "names_to_variables must be a dict mapping string " "names to Tensors/Variables. Not a variable: %s" % variable ) self . _AddVarToSave ( vars_to_save , seen_variables , variable , "" , name ) return vars_to_save