original_docstring: Builds a basic Seq2Seq model.
  
      Keyword Arguments:
          rnn_dim: hidden dimensionality of the LSTM cells
          num_encoder_tokens: total number of tokens in the encoder input
          num_decoder_tokens: total number of tokens in the decoder input
          sampling: if true, will define models that can be used to sample
      
docstring: Builds a basic Seq2Seq model.
docstring_tokens: Builds a basic Seq2Seq model .
code: def build_seq2seq(rnn_dim, num_encoder_tokens, num_decoder_tokens, depth=2, sampling=True):
      """Builds a basic Seq2Seq model.
  
      Keyword Arguments:
          rnn_dim: hidden dimensionality of the LSTM cells
          num_encoder_tokens: total number of tokens in the encoder input
          num_decoder_tokens: total number of tokens in the decoder input
          sampling: if true, will define models that can be used to sample
      """
      # TODO: Add depth parameter
      encoder_inputs = Input(shape=(None, num_encoder_tokens))
      encoder = LSTM(rnn_dim, return_state=True, input_shape=(None, num_encoder_tokens))
      encoder_outputs, state_h, state_c = encoder(encoder_inputs)
      encoder_states = [state_h, state_c]
  
      decoder_inputs = Input(shape=(None, num_decoder_tokens))
      decoder = LSTM(rnn_dim, return_sequences=True, return_state=True, input_shape=(None,  num_decoder_tokens))
      decoder_outputs, _, _= decoder(decoder_inputs, initial_state=encoder_states)
      decoder_dense = Dense(num_decoder_tokens, activation='softmax')
      decoder_outputs = decoder_dense(decoder_outputs)
  
      model = Model([encoder_inputs, decoder_inputs], decoder_outputs)
  
      if sampling:
          encoder_model = Model(encoder_inputs, encoder_states)
  
          decoder_state_input_h = Input(shape=(rnn_dim,))
          decoder_state_input_c = Input(shape=(rnn_dim,))
          decoder_states_inputs = [decoder_state_input_h, decoder_state_input_c]
          decoder_outputs, state_h, state_c = decoder(decoder_inputs, initial_state=decoder_states_inputs)
          decoder_states = [state_h, state_c]
          decoder_outputs = decoder_dense(decoder_outputs)
          decoder_model = Model(
              [decoder_inputs] + decoder_states_inputs,
              [decoder_outputs] + decoder_states)
  
          return model, encoder_model, decoder_model
  
      return model
code_tokens: def build_seq2seq ( rnn_dim , num_encoder_tokens , num_decoder_tokens , depth = 2 , sampling = True ) : encoder_inputs = Input ( shape = ( None , num_encoder_tokens ) ) encoder = LSTM ( rnn_dim , return_state = True , input_shape = ( None , num_encoder_tokens ) ) encoder_outputs , state_h , state_c = encoder ( encoder_inputs ) encoder_states = [ state_h , state_c ] decoder_inputs = Input ( shape = ( None , num_decoder_tokens ) ) decoder = LSTM ( rnn_dim , return_sequences = True , return_state = True , input_shape = ( None , num_decoder_tokens ) ) decoder_outputs , _ , _ = decoder ( decoder_inputs , initial_state = encoder_states ) decoder_dense = Dense ( num_decoder_tokens , activation = 'softmax' ) decoder_outputs = decoder_dense ( decoder_outputs ) model = Model ( [ encoder_inputs , decoder_inputs ] , decoder_outputs ) if sampling : encoder_model = Model ( encoder_inputs , encoder_states ) decoder_state_input_h = Input ( shape = ( rnn_dim , ) ) decoder_state_input_c = Input ( shape = ( rnn_dim , ) ) decoder_states_inputs = [ decoder_state_input_h , decoder_state_input_c ] decoder_outputs , state_h , state_c = decoder ( decoder_inputs , initial_state = decoder_states_inputs ) decoder_states = [ state_h , state_c ] decoder_outputs = decoder_dense ( decoder_outputs ) decoder_model = Model ( [ decoder_inputs ] + decoder_states_inputs , [ decoder_outputs ] + decoder_states ) return model , encoder_model , decoder_model return model
short_docstring: Builds a basic Seq2Seq model.
short_docstring_tokens: Builds a basic Seq2Seq model .
comment: """Builds a basic Seq2Seq model.
  
      Keyword Arguments:
          rnn_dim: hidden dimensionality of the LSTM cells
          num_encoder_tokens: total number of tokens in the encoder input
          num_decoder_tokens: total number of tokens in the decoder input
          sampling: if true, will define models that can be used to sample
      """$SEP$# TODO: Add depth parameter