class_docstr: Layer that captures the basic interactions between two tensors.
  
  :param channels: Number of word interaction tensor channels
  :param normalize: Whether to L2-normalize samples along the
      dot product axis before taking the dot product.
      If set to True, then the output of the dot product
      is the cosine proximity between the two samples.
  :param init_diag: Whether to initialize the diagonal elements
      of the matrix.
  :param kwargs: Standard layer keyword arguments.
  
  Examples:
      >>> import matchzoo as mz
      >>> layer = mz.contrib.layers.MatchingTensorLayer(channels=4,
      ...                                               normalize=True,
      ...                                               init_diag=True)
      >>> num_batch, left_len, right_len, num_dim = 5, 3, 2, 10
      >>> layer.build([[num_batch, left_len, num_dim],
      ...              [num_batch, right_len, num_dim]])
docstr: Build the layer.
  
  :param input_shape: the shapes of the input tensors,
      for MatchingTensorLayer we need two input tensors.
code: def build(self, input_shape: list):
      """
      Build the layer.
  
      :param input_shape: the shapes of the input tensors,
          for MatchingTensorLayer we need two input tensors.
      """
      # Used purely for shape validation.
      if not isinstance(input_shape, list) or len(input_shape) != 2:
          raise ValueError(
              "A `MatchingTensorLayer` layer should be called "
              "on a list of 2 inputs."
          )
      self._shape1 = input_shape[0]
      self._shape2 = input_shape[1]
      for idx in (0, 2):
          if self._shape1[idx] != self._shape2[idx]:
              raise ValueError(
                  "Incompatible dimensions: "
                  f"{self._shape1[idx]} != {self._shape2[idx]}."
                  f"Layer shapes: {self._shape1}, {self._shape2}."
              )
  
      if self._init_diag:
          interaction_matrix = np.float32(
              np.random.uniform(
                  -0.05,
                  0.05,
                  [self._channels, self._shape1[2], self._shape2[2]],
              )
          )
          for channel_index in range(self._channels):
              np.fill_diagonal(interaction_matrix[channel_index], 0.1)
          self.interaction_matrix = self.add_weight(
              name="interaction_matrix",
              shape=(self._channels, self._shape1[2], self._shape2[2]),
              initializer=constant(interaction_matrix),
              trainable=True,
          )
      else:
          self.interaction_matrix = self.add_weight(
              name="interaction_matrix",
              shape=(self._channels, self._shape1[2], self._shape2[2]),
              initializer="uniform",
              trainable=True,
          )
      super(MatchingTensorLayer, self).build(input_shape)
  
file_path: MatchZoo/matchzoo/contrib/layers/matching_tensor_layer.py
imports: import typing
  import numpy
  import tensorflow
  from keras import backend
  from keras.engine import Layer
  from keras.initializers import constant
label_desc: Use image node_id 2 for calling the MatchingTensorLayer obj's underlying member method code with example usage: obj.build(input_shape) without return types