class_docstr: Multi-Task Intent and Slot tagging model (using tf.keras)
  
  Args:
      use_cudnn (bool, optional): use GPU based model (CUDNNA cells)
class_docstr_tok: ["Multi-Task","Intent","and","Slot","tagging","model","(","using","tf.keras",")","Args",":","use_cudnn","(","bool",",","optional",")",":","use","GPU","based","model","(","CUDNNA","cells",")"]
docstr: Build a model
  
  Args:
      word_length (int): max word length (in characters)
      num_labels (int): number of slot labels
      num_intent_labels (int): number of intent classes
      word_vocab_size (int): word vocabulary size
      char_vocab_size (int): character vocabulary size
      word_emb_dims (int, optional): word embedding dimensions
      char_emb_dims (int, optional): character embedding dimensions
      char_lstm_dims (int, optional): character feature LSTM hidden size
      tagger_lstm_dims (int, optional): tagger LSTM hidden size
      dropout (float, optional): dropout rate
docstr_tok: ["Build","a","model","Args",":","word_length","(","int",")",":","max","word","length","(","in","characters",")","num_labels","(","int",")",":","number","of","slot","labels","num_intent_labels","(","int",")",":","number","of","intent","classes","word_vocab_size","(","int",")",":","word","vocabulary","size","char_vocab_size","(","int",")",":","character","vocabulary","size","word_emb_dims","(","int",",","optional",")",":","word","embedding","dimensions","char_emb_dims","(","int",",","optional",")",":","character","embedding","dimensions","char_lstm_dims","(","int",",","optional",")",":","character","feature","LSTM","hidden","size","tagger_lstm_dims","(","int",",","optional",")",":","tagger","LSTM","hidden","size","dropout","(","float",",","optional",")",":","dropout","rate"]
code: def build(
      self,
      word_length,
      num_labels,
      num_intent_labels,
      word_vocab_size,
      char_vocab_size,
      word_emb_dims=100,
      char_emb_dims=30,
      char_lstm_dims=30,
      tagger_lstm_dims=100,
      dropout=0.2,
  ):
      """
      Build a model
  
      Args:
          word_length (int): max word length (in characters)
          num_labels (int): number of slot labels
          num_intent_labels (int): number of intent classes
          word_vocab_size (int): word vocabulary size
          char_vocab_size (int): character vocabulary size
          word_emb_dims (int, optional): word embedding dimensions
          char_emb_dims (int, optional): character embedding dimensions
          char_lstm_dims (int, optional): character feature LSTM hidden size
          tagger_lstm_dims (int, optional): tagger LSTM hidden size
          dropout (float, optional): dropout rate
      """
      self.word_length = word_length
      self.num_labels = num_labels
      self.num_intent_labels = num_intent_labels
      self.word_vocab_size = word_vocab_size
      self.char_vocab_size = char_vocab_size
      self.word_emb_dims = word_emb_dims
      self.char_emb_dims = char_emb_dims
      self.char_lstm_dims = char_lstm_dims
      self.tagger_lstm_dims = tagger_lstm_dims
      self.dropout = dropout
  
      words_input = tf.keras.layers.Input(
          shape=(None,), name="words_input"
      )
      embedding_layer = tf.keras.layers.Embedding(
          self.word_vocab_size,
          self.word_emb_dims,
          name="word_embedding",
      )
      word_embeddings = embedding_layer(words_input)
      word_embeddings = tf.keras.layers.Dropout(self.dropout)(
          word_embeddings
      )
  
      # create word character input and embeddings layer
      word_chars_input = tf.keras.layers.Input(
          shape=(None, self.word_length), name="word_chars_input"
      )
      char_embedding_layer = tf.keras.layers.Embedding(
          self.char_vocab_size,
          self.char_emb_dims,
          input_length=self.word_length,
          name="char_embedding",
      )
      # apply embedding to each word
      char_embeddings = char_embedding_layer(word_chars_input)
      # feed dense char vectors into BiLSTM
      char_embeddings = tf.keras.layers.TimeDistributed(
          tf.keras.layers.Bidirectional(
              self._rnn_cell(self.char_lstm_dims)
          )
      )(char_embeddings)
      char_embeddings = tf.keras.layers.Dropout(self.dropout)(
          char_embeddings
      )
  
      # first BiLSTM layer (used for intent classification)
      first_bilstm_layer = tf.keras.layers.Bidirectional(
          self._rnn_cell(
              self.tagger_lstm_dims,
              return_sequences=True,
              return_state=True,
          )
      )
      first_lstm_out = first_bilstm_layer(word_embeddings)
  
      lstm_y_sequence = first_lstm_out[:1][
          0
      ]  # save y states of the LSTM layer
      states = first_lstm_out[1:]
      hf, _, hb, _ = states  # extract last hidden states
      h_state = tf.keras.layers.concatenate([hf, hb], axis=-1)
      intents = tf.keras.layers.Dense(
          self.num_intent_labels,
          activation="softmax",
          name="intent_classifier_output",
      )(h_state)
  
      # create the 2nd feature vectors
      combined_features = tf.keras.layers.concatenate(
          [lstm_y_sequence, char_embeddings], axis=-1
      )
  
      # 2nd BiLSTM layer for label classification
      second_bilstm_layer = tf.keras.layers.Bidirectional(
          self._rnn_cell(self.tagger_lstm_dims, return_sequences=True)
      )(combined_features)
      second_bilstm_layer = tf.keras.layers.Dropout(self.dropout)(
          second_bilstm_layer
      )
      bilstm_out = tf.keras.layers.Dense(self.num_labels)(
          second_bilstm_layer
      )
  
      # feed BiLSTM vectors into CRF
      with tf.device("/cpu:0"):
          crf = CRF(self.num_labels, name="intent_slot_crf")
          labels = crf(bilstm_out)
  
      # compile the model
      model = tf.keras.Model(
          inputs=[words_input, word_chars_input],
          outputs=[intents, labels],
      )
  
      # define losses and metrics
      loss_f = {
          "intent_classifier_output": "categorical_crossentropy",
          "intent_slot_crf": crf.loss,
      }
      metrics = {
          "intent_classifier_output": "categorical_accuracy",
          "intent_slot_crf": crf.viterbi_accuracy,
      }
  
      model.compile(
          loss=loss_f,
          optimizer=tf.train.AdamOptimizer(),
          metrics=metrics,
      )
      self.model = model
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import tensorflow
  from nlp_architect.nn.tensorflow.python.keras.layers.crf import CRF
  from nlp_architect.nn.tensorflow.python.keras.utils import load_model, save_model
label_desc: Use image node_id 2 for calling the MultiTaskIntentModel obj's underlying member method code with example usage: obj.build(word_length, num_labels, num_intent_labels, word_vocab_size, char_vocab_size, word_emb_dims, char_emb_dims, char_lstm_dims, tagger_lstm_dims, dropout) without return types