parameters: (self, inputs, sequence_length, time_major=False)
docstring: Constructor of TrainingHelper.
  
          Parameters:
              inputs(Variable): A (possibly nested structure of) tensor variable[s]. 
                  The shape of tensor should be `[batch_size, sequence_length, ...]`
                  for `time_major == False` or `[sequence_length, batch_size, ...]`
                  for `time_major == True`. It represents the inputs to be sliced
                  from at every decoding step.
              sequence_length(Variable): A tensor with shape `[batch_size]`.
                  It stores real length of each instance in `inputs`, by which we
                  can label the finished status of each instance at every decoding
                  step.
              time_major(bool, optional): Indicate the data layout of Tensor included
                  in `inputs`. If `False`, the data layout would be batch major with
                  shape `[batch_size, sequence_length, ...]`.  If `True`, the data
                  layout would be time major with shape `[sequence_length, batch_size, ...]`.
                  Default: `False`.
docstring_summary: Constructor of TrainingHelper.
docstring_tokens: Constructor of TrainingHelper .
function: def __init__(self, inputs, sequence_length, time_major=False):
          """
          Constructor of TrainingHelper.
  
          Parameters:
              inputs(Variable): A (possibly nested structure of) tensor variable[s]. 
                  The shape of tensor should be `[batch_size, sequence_length, ...]`
                  for `time_major == False` or `[sequence_length, batch_size, ...]`
                  for `time_major == True`. It represents the inputs to be sliced
                  from at every decoding step.
              sequence_length(Variable): A tensor with shape `[batch_size]`.
                  It stores real length of each instance in `inputs`, by which we
                  can label the finished status of each instance at every decoding
                  step.
              time_major(bool, optional): Indicate the data layout of Tensor included
                  in `inputs`. If `False`, the data layout would be batch major with
                  shape `[batch_size, sequence_length, ...]`.  If `True`, the data
                  layout would be time major with shape `[sequence_length, batch_size, ...]`.
                  Default: `False`.
          """
          self.inputs = inputs
          self.sequence_length = sequence_length
          self.time_major = time_major
          # extend inputs to avoid to slice out of range in `next_inputs`
          # may be easier and have better performance than condition_op
          self.inputs_ = map_structure(
              lambda x: nn.pad(x,
                               paddings=([0, 1] + [0, 0] * (len(x.shape) - 1))
                               if time_major else ([0, 0, 0, 1] + [0, 0] *
                                                   (len(x.shape) - 2))),
              self.inputs)
function_tokens: def __init__ ( self , inputs , sequence_length , time_major = False ) : self . inputs = inputs self . sequence_length = sequence_length self . time_major = time_major # extend inputs to avoid to slice out of range in `next_inputs` # may be easier and have better performance than condition_op self . inputs_ = map_structure ( lambda x : nn . pad ( x , paddings = ( [ 0 , 1 ] + [ 0 , 0 ] * ( len ( x . shape ) - 1 ) ) if time_major else ( [ 0 , 0 , 0 , 1 ] + [ 0 , 0 ] * ( len ( x . shape ) - 2 ) ) ) , self . inputs )