'Initializer.
Args:
embedding: A callable that takes a vector tensor of `ids` (argmax ids),
or the `params` argument for `embedding_lookup`.
start_tokens: `int32` vector shaped `[batch_size]`, the start tokens.
end_token: `int32` scalar, the token that marks end of decoding.
Raises:
ValueError: if `sequence_length` is not a 1D tensor.'

def __init__(self, embedding, start_tokens, end_token):

    if callable(embedding):
        self._embedding_fn = embedding
    else:
        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)
