parameters: (self, embedding, start_tokens=None, end_token=None)
return_statement: return (finished, self.start_inputs)
docstring: Initialize the GreedyEmbeddingSampler.
  
      Args:
        embedding: tensor that contains embedding states matrix. It will be used
          to generate generate outputs with start_tokens and end_tokens. The
          embedding will be ignored if the embedding_fn has been provided at
          __init__().
        start_tokens: `int32` vector shaped `[batch_size]`, the start tokens.
        end_token: `int32` scalar, the token that marks end of decoding.
  
      Returns:
        Tuple of two items: `(finished, self.start_inputs)`.
      Raises:
        ValueError: if `start_tokens` is not a 1D tensor or `end_token` is not a
          scalar.
docstring_summary: Initialize the GreedyEmbeddingSampler.
docstring_tokens: Initialize the GreedyEmbeddingSampler .
function: def initialize(self, embedding, start_tokens=None, end_token=None):
      """Initialize the GreedyEmbeddingSampler.
  
      Args:
        embedding: tensor that contains embedding states matrix. It will be used
          to generate generate outputs with start_tokens and end_tokens. The
          embedding will be ignored if the embedding_fn has been provided at
          __init__().
        start_tokens: `int32` vector shaped `[batch_size]`, the start tokens.
        end_token: `int32` scalar, the token that marks end of decoding.
  
      Returns:
        Tuple of two items: `(finished, self.start_inputs)`.
      Raises:
        ValueError: if `start_tokens` is not a 1D tensor or `end_token` is not a
          scalar.
      """
      if self.embedding_fn is None:
        self.embedding_fn = (
            lambda ids: embedding_ops.embedding_lookup(embedding, ids))
  
      self.start_tokens = ops.convert_to_tensor(
          start_tokens, dtype=dtypes.int32, name="start_tokens")
      self.end_token = ops.convert_to_tensor(
          end_token, dtype=dtypes.int32, name="end_token")
      if self.start_tokens.get_shape().ndims != 1:
        raise ValueError("start_tokens must be a vector")
      self._batch_size = array_ops.size(start_tokens)
      if self.end_token.get_shape().ndims != 0:
        raise ValueError("end_token must be a scalar")
      self.start_inputs = self.embedding_fn(self.start_tokens)
  
      finished = array_ops.tile([False], [self._batch_size])
      return (finished, self.start_inputs)
function_tokens: def initialize ( self , embedding , start_tokens = None , end_token = None ) : if self . embedding_fn is None : self . embedding_fn = ( lambda ids : embedding_ops . embedding_lookup ( embedding , ids ) ) self . start_tokens = ops . convert_to_tensor ( start_tokens , dtype = dtypes . int32 , name = "start_tokens" ) self . end_token = ops . convert_to_tensor ( end_token , dtype = dtypes . int32 , name = "end_token" ) if self . start_tokens . get_shape ( ) . ndims != 1 : raise ValueError ( "start_tokens must be a vector" ) self . _batch_size = array_ops . size ( start_tokens ) if self . end_token . get_shape ( ) . ndims != 0 : raise ValueError ( "end_token must be a scalar" ) self . start_inputs = self . embedding_fn ( self . start_tokens ) finished = array_ops . tile ( [ False ] , [ self . _batch_size ] ) return ( finished , self . start_inputs )