parameters: (self)
return_statement: return _feed_dict_fn
docstring: Returns a function that samples data into given placeholders.
  
      Returns:
        A function that when called samples a random subset of batch size
        from x and y.
docstring_summary: Returns a function that samples data into given placeholders.
docstring_tokens: Returns a function that samples data into given placeholders .
function: def get_feed_dict_fn(self):
      """Returns a function that samples data into given placeholders.
  
      Returns:
        A function that when called samples a random subset of batch size
        from x and y.
      """
      def _feed_dict_fn():
        """Function that samples data into given placeholders."""
        if self.max_epochs is not None and self.epoch + 1 > self.max_epochs:
          raise StopIteration
        assert self._input_placeholder is not None
        feed_dict = {}
        if self._epoch_placeholder is not None:
          feed_dict[self._epoch_placeholder.name] = [self.epoch]
  
        # Take next batch of indices.
        end = min(self._x.shape[0], self.offset + self._batch_size)
        batch_indices = self.indices[self.offset:end]
  
        # Assign input features from random indices.
        inp = (
            np.array(_access(self._x, batch_indices)).reshape(
                (batch_indices.shape[0], 1))
            if len(self._x.shape) == 1 else _access(self._x, batch_indices))
        feed_dict[self._input_placeholder.name] = inp
  
        # move offset and reset it if necessary
        self.offset += self._batch_size
        if self.offset >= self._x.shape[0]:
          self.indices = self.random_state.permutation(self._x.shape[0])
          self.offset = 0
          self.epoch += 1
  
        # return early if there are no labels
        if self._output_placeholder is None:
          return feed_dict
  
        # assign labels from random indices
        self.output_shape[0] = batch_indices.shape[0]
        out = np.zeros(self.output_shape, dtype=self._output_dtype)
        for i in xrange(out.shape[0]):
          sample = batch_indices[i]
          # self.n_classes is None means we're passing in raw target indices
          if self.n_classes is None:
            out[i] = _access(self._y, sample)
          else:
            if self.n_classes > 1:
              if len(self.output_shape) == 2:
                out.itemset((i, int(_access(self._y, sample))), 1.0)
              else:
                for idx, value in enumerate(_access(self._y, sample)):
                  out.itemset(tuple([i, idx, value]), 1.0)
            else:
              out[i] = _access(self._y, sample)
        feed_dict[self._output_placeholder.name] = out
  
        return feed_dict
  
      return _feed_dict_fn
function_tokens: def get_feed_dict_fn ( self ) : def _feed_dict_fn ( ) : """Function that samples data into given placeholders.""" if self . max_epochs is not None and self . epoch + 1 > self . max_epochs : raise StopIteration assert self . _input_placeholder is not None feed_dict = { } if self . _epoch_placeholder is not None : feed_dict [ self . _epoch_placeholder . name ] = [ self . epoch ] # Take next batch of indices. end = min ( self . _x . shape [ 0 ] , self . offset + self . _batch_size ) batch_indices = self . indices [ self . offset : end ] # Assign input features from random indices. inp = ( np . array ( _access ( self . _x , batch_indices ) ) . reshape ( ( batch_indices . shape [ 0 ] , 1 ) ) if len ( self . _x . shape ) == 1 else _access ( self . _x , batch_indices ) ) feed_dict [ self . _input_placeholder . name ] = inp # move offset and reset it if necessary self . offset += self . _batch_size if self . offset >= self . _x . shape [ 0 ] : self . indices = self . random_state . permutation ( self . _x . shape [ 0 ] ) self . offset = 0 self . epoch += 1 # return early if there are no labels if self . _output_placeholder is None : return feed_dict # assign labels from random indices self . output_shape [ 0 ] = batch_indices . shape [ 0 ] out = np . zeros ( self . output_shape , dtype = self . _output_dtype ) for i in xrange ( out . shape [ 0 ] ) : sample = batch_indices [ i ] # self.n_classes is None means we're passing in raw target indices if self . n_classes is None : out [ i ] = _access ( self . _y , sample ) else : if self . n_classes > 1 : if len ( self . output_shape ) == 2 : out . itemset ( ( i , int ( _access ( self . _y , sample ) ) ) , 1.0 ) else : for idx , value in enumerate ( _access ( self . _y , sample ) ) : out . itemset ( tuple ( [ i , idx , value ] ) , 1.0 ) else : out [ i ] = _access ( self . _y , sample ) feed_dict [ self . _output_placeholder . name ] = out return feed_dict return _feed_dict_fn