class_docstr: DIIN model.
  
  Examples:
      >>> model = DIIN()
      >>> model.guess_and_fill_missing_params()
      >>> model.params['embedding_input_dim'] = 10000
      >>> model.params['embedding_output_dim'] = 300
      >>> model.params['embedding_trainable'] = True
      >>> model.params['optimizer'] = 'adam'
      >>> model.params['dropout_initial_keep_rate'] = 1.0
      >>> model.params['dropout_decay_interval'] = 10000
      >>> model.params['dropout_decay_rate'] = 0.977
      >>> model.params['char_embedding_input_dim'] = 100
      >>> model.params['char_embedding_output_dim'] = 8
      >>> model.params['char_conv_filters'] = 100
      >>> model.params['char_conv_kernel_size'] = 5
      >>> model.params['first_scale_down_ratio'] = 0.3
      >>> model.params['nb_dense_blocks'] = 3
      >>> model.params['layers_per_dense_block'] = 8
      >>> model.params['growth_rate'] = 20
      >>> model.params['transition_scale_down_ratio'] = 0.5
      >>> model.build()
class_docstr_tok: ["DIIN","model",".","Examples",":",">",">",">","model","=","DIIN","(",")",">",">",">","model.guess_and_fill_missing_params","(",")",">",">",">","model.params","[","'embedding_input_dim","'","]","=","10000",">",">",">","model.params","[","'embedding_output_dim","'","]","=","300",">",">",">","model.params","[","'embedding_trainable","'","]","=","True",">",">",">","model.params","[","'optimizer","'","]","=","'adam'",">",">",">","model.params","[","'dropout_initial_keep_rate","'","]","=","1.0",">",">",">","model.params","[","'dropout_decay_interval","'","]","=","10000",">",">",">","model.params","[","'dropout_decay_rate","'","]","=","0.977",">",">",">","model.params","[","'char_embedding_input_dim","'","]","=","100",">",">",">","model.params","[","'char_embedding_output_dim","'","]","=","8",">",">",">","model.params","[","'char_conv_filters","'","]","=","100",">",">",">","model.params","[","'char_conv_kernel_size","'","]","=","5",">",">",">","model.params","[","'first_scale_down_ratio","'","]","=","0.3",">",">",">","model.params","[","'nb_dense_blocks","'","]","=","3",">",">",">","model.params","[","'layers_per_dense_block","'","]","=","8",">",">",">","model.params","[","'growth_rate","'","]","=","20",">",">",">","model.params","[","'transition_scale_down_ratio","'","]","=","0.5",">",">",">","model.build","(",")"]
docstr: Build model structure.
docstr_tok: ["Build","model","structure","."]
code: def build(self):
      """Build model structure."""
  
      # Scalar dimensions referenced here:
      #   B = batch size (number of sequences)
      #   D = word embedding size
      #   L = 'input_left' sequence length
      #   R = 'input_right' sequence length
      #   C = fixed word length
  
      inputs = self._make_inputs()
      # Left text and right text.
      # shape = [B, L]
      # shape = [B, R]
      text_left, text_right = inputs[0:2]
      # Left character and right character.
      # shape = [B, L, C]
      # shape = [B, R, C]
      char_left, char_right = inputs[2:4]
      # Left exact match and right exact match.
      # shape = [B, L]
      # shape = [B, R]
      match_left, match_right = inputs[4:6]
  
      # Embedding module
      left_embeddings = []
      right_embeddings = []
  
      # Word embedding feature
      word_embedding = self._make_embedding_layer()
      # shape = [B, L, D]
      left_word_embedding = word_embedding(text_left)
      # shape = [B, R, D]
      right_word_embedding = word_embedding(text_right)
      left_word_embedding = DecayingDropoutLayer(
          initial_keep_rate=self._params["dropout_initial_keep_rate"],
          decay_interval=self._params["dropout_decay_interval"],
          decay_rate=self._params["dropout_decay_rate"],
      )(left_word_embedding)
      right_word_embedding = DecayingDropoutLayer(
          initial_keep_rate=self._params["dropout_initial_keep_rate"],
          decay_interval=self._params["dropout_decay_interval"],
          decay_rate=self._params["dropout_decay_rate"],
      )(right_word_embedding)
      left_embeddings.append(left_word_embedding)
      right_embeddings.append(right_word_embedding)
  
      # Exact match feature
      # shape = [B, L, 1]
      left_exact_match = keras.layers.Reshape(
          target_shape=(
              K.int_shape(match_left)[1],
              1,
          )
      )(match_left)
      # shape = [B, R, 1]
      right_exact_match = keras.layers.Reshape(
          target_shape=(
              K.int_shape(match_left)[1],
              1,
          )
      )(match_right)
      left_embeddings.append(left_exact_match)
      right_embeddings.append(right_exact_match)
  
      # Char embedding feature
      char_embedding = self._make_char_embedding_layer()
      char_embedding.build(
          input_shape=(None, None, K.int_shape(char_left)[-1])
      )
      left_char_embedding = char_embedding(char_left)
      right_char_embedding = char_embedding(char_right)
      left_embeddings.append(left_char_embedding)
      right_embeddings.append(right_char_embedding)
  
      # Concatenate
      left_embedding = keras.layers.Concatenate()(left_embeddings)
      right_embedding = keras.layers.Concatenate()(right_embeddings)
      d = K.int_shape(left_embedding)[-1]
  
      # Encoding module
      left_encoding = EncodingLayer(
          initial_keep_rate=self._params["dropout_initial_keep_rate"],
          decay_interval=self._params["dropout_decay_interval"],
          decay_rate=self._params["dropout_decay_rate"],
      )(left_embedding)
      right_encoding = EncodingLayer(
          initial_keep_rate=self._params["dropout_initial_keep_rate"],
          decay_interval=self._params["dropout_decay_interval"],
          decay_rate=self._params["dropout_decay_rate"],
      )(right_embedding)
  
      # Interaction module
      interaction = keras.layers.Lambda(self._make_interaction)(
          [left_encoding, right_encoding]
      )
  
      # Feature extraction module
      feature_extractor_input = keras.layers.Conv2D(
          filters=int(d * self._params["first_scale_down_ratio"]),
          kernel_size=(1, 1),
          activation=None,
      )(interaction)
      feature_extractor = self._create_densenet()
      features = feature_extractor(feature_extractor_input)
  
      # Output module
      features = DecayingDropoutLayer(
          initial_keep_rate=self._params["dropout_initial_keep_rate"],
          decay_interval=self._params["dropout_decay_interval"],
          decay_rate=self._params["dropout_decay_rate"],
      )(features)
      out = self._make_output_layer()(features)
  
      self._backend = keras.Model(inputs=inputs, outputs=out)
  
imports: import typing
  import keras
  import keras.backend
  import tensorflow
  from matchzoo import preprocessors
  from matchzoo.contrib.layers import DecayingDropoutLayer
  from matchzoo.contrib.layers import EncodingLayer
  from matchzoo.engine import hyper_spaces
  from matchzoo.engine.base_model import BaseModel
  from matchzoo.engine.param import Param
  from matchzoo.engine.param_table import ParamTable
label_desc: Use image node_id 5 for calling the DIIN obj's underlying member method code with example usage: obj.build() without return types