(self, input_shape: list)
Calculate the layer output shape.
        :param input_shape: the shapes of the input tensors,
            for MatchingLayer we need tow input tensors.
Calculate the layer output shape.
        :param input_shape: the shapes of the input tensors,
            for MatchingLayer we need tow input tensors.
Calculate the layer output shape . : param input_shape : the shapes of the input tensors for MatchingLayer we need tow input tensors .
def compute_output_shape(self, input_shape: list) -> tuple:
    """
        Calculate the layer output shape.
        :param input_shape: the shapes of the input tensors,
            for MatchingLayer we need tow input tensors.
        """
    if not isinstance(input_shape, list) or len(input_shape) != 2:
      raise ValueError('A `MatchingLayer` layer should be called '
                       'on a list of 2 inputs.')
    shape1 = list(input_shape[0])
    shape2 = list(input_shape[1])
    if len(shape1) != 3 or len(shape2) != 3:
      raise ValueError('A `MatchingLayer` layer should be called '
                       'on 2 inputs with 3 dimensions.')
    if shape1[0] != shape2[0] or shape1[2] != shape2[2]:
      raise ValueError('A `MatchingLayer` layer should be called '
                       'on 2 inputs with same 0,2 dimensions.')

    if self._matching_type in ['mul', 'plus', 'minus']:
      return shape1[0], shape1[1], shape2[1], shape1[2]
    elif self._matching_type == 'dot':
      return shape1[0], shape1[1], shape2[1], 1
    elif self._matching_type == 'concat':
      return shape1[0], shape1[1], shape2[1], shape1[2] + shape2[2]
    else:
      raise ValueError(f"Invalid `matching_type`."
                       f"{self._matching_type} received."
                       f"Must be in `mul`, `plus`, `minus` "
                       f"`dot` and `concat`.")
def compute_output_shape ( self , input_shape : list ) -> tuple : if not isinstance ( input_shape , list ) or len ( input_shape ) != 2 : raise ValueError ( 'A `MatchingLayer` layer should be called ' 'on a list of 2 inputs.' ) shape1 = list ( input_shape [ 0 ] ) shape2 = list ( input_shape [ 1 ] ) if len ( shape1 ) != 3 or len ( shape2 ) != 3 : raise ValueError ( 'A `MatchingLayer` layer should be called ' 'on 2 inputs with 3 dimensions.' ) if shape1 [ 0 ] != shape2 [ 0 ] or shape1 [ 2 ] != shape2 [ 2 ] : raise ValueError ( 'A `MatchingLayer` layer should be called ' 'on 2 inputs with same 0,2 dimensions.' ) if self . _matching_type in [ 'mul' , 'plus' , 'minus' ] : return shape1 [ 0 ] , shape1 [ 1 ] , shape2 [ 1 ] , shape1 [ 2 ] elif self . _matching_type == 'dot' : return shape1 [ 0 ] , shape1 [ 1 ] , shape2 [ 1 ] , 1 elif self . _matching_type == 'concat' : return shape1 [ 0 ] , shape1 [ 1 ] , shape2 [ 1 ] , shape1 [ 2 ] + shape2 [ 2 ] else : raise ValueError ( f"Invalid `matching_type`." f"{self._matching_type} received." f"Must be in `mul`, `plus`, `minus` " f"`dot` and `concat`." )