def call(self, inputs, **kwargs):
    """Compute similarity between inputs via product.

    In tensor size descriptions, ... indicates an arbitrary number of
    dimensions.
    For example, this can compute similarity for any of these:
    - Dialogs: (batch_size, n_messages, n_words, size)
    - Text: (batch_size, n_words, size)
    - Hidden State: (batch_size, size)

    Args:
      inputs: Two input tensors
      **kwargs: API Compat

    Returns:
      Product similarity tensor
    """
    # (batch_size, ..., size)
    a = inputs[0]
    # (batch_size, ..., size)
    b = inputs[1]
    # (batch_size, ..., 1)
    return tf.expand_dims(tf.reduce_sum(a * b, axis=-1), -1)
Compute similarity between inputs via product.

    In tensor size descriptions, ... indicates an arbitrary number of
    dimensions.
    For example, this can compute similarity for any of these:
    - Dialogs: (batch_size, n_messages, n_words, size)
    - Text: (batch_size, n_words, size)
    - Hidden State: (batch_size, size)

    Args:
      inputs: Two input tensors
      **kwargs: API Compat

    Returns:
      Product similarity tensor
    
language/serene/layers.py