code: def _get_initial_state(
      initial_state,
      tiled_initial_state,
      cell,
      batch_size,
      beam_width,
      dtype,
  ):
      if tiled_initial_state is None:
          if isinstance(initial_state, AttentionWrapperState):
              raise ValueError(
                  "`initial_state` must not be an AttentionWrapperState. Use "
                  "a plain cell state instead, which will be wrapped into an "
                  "AttentionWrapperState automatically."
              )
          if initial_state is None:
              tiled_initial_state = cell.zero_state(
                  batch_size * beam_width, dtype
              )
          else:
              tiled_initial_state = tile_batch(
                  initial_state, multiplier=beam_width
              )
  
      if isinstance(cell, AttentionWrapper) and not isinstance(
          tiled_initial_state, AttentionWrapperState
      ):
          zero_state = cell.zero_state(batch_size * beam_width, dtype)
          tiled_initial_state = zero_state.clone(
              cell_state=tiled_initial_state
          )
  
      return tiled_initial_state
  
imports: import tensorflow
  from tensorflow.contrib.seq2seq import dynamic_decode, AttentionWrapperState, AttentionWrapper, BeamSearchDecoder, tile_batch
  from texar.tf.modules.decoders.rnn_decoder_base import RNNDecoderBase
label_desc: Use image node_id 1 for calling a global function with example usage: _get_initial_state(initial_state, tiled_initial_state, cell, batch_size, beam_width, dtype) and returns: tiled_initial_state