class_docstr: Base Attention class for Dense networks.
  
  This class is suitable for Dense or CNN networks, and not for RNN networks.
  
  Implementations of attention mechanisms should inherit from this class, and
  reuse the `apply_attention_scores()` method.
  
  Args:
    causal: Boolean. Set to `True` for decoder self-attention. Adds a mask such
      that position `i` cannot attend to positions `j > i`. This prevents the
      flow of information from the future towards the past.
    dropout: Float between 0 and 1. Fraction of the units to drop for the
      attention scores.
  
  Call Args:
  
    inputs: List of the following tensors:
      * query: Query `Tensor` of shape `[batch_size, Tq, dim]`.
      * value: Value `Tensor` of shape `[batch_size, Tv, dim]`.
      * key: Optional key `Tensor` of shape `[batch_size, Tv, dim]`. If not
        given, will use `value` for both `key` and `value`, which is the
        most common case.
    mask: List of the following tensors:
      * query_mask: A boolean mask `Tensor` of shape `[batch_size, Tq]`.
        If given, the output will be zero at the positions where
        `mask==False`.
      * value_mask: A boolean mask `Tensor` of shape `[batch_size, Tv]`.
        If given, will apply the mask such that values at positions where
        `mask==False` do not contribute to the result.
    training: Python boolean indicating whether the layer should behave in
      training mode (adding dropout) or in inference mode (no dropout).
    return_attention_scores: bool, it `True`, returns the attention scores
      (after masking and softmax) as an additional output argument.
  
  Output:
  
    Attention outputs of shape `[batch_size, Tq, dim]`.
    [Optional] Attention scores after masking and softmax with shape
      `[batch_size, Tq, Tv]`.
class_docstr_tok: ["Base","Attention","class","for","Dense","networks",".","This","class","is","suitable","for","Dense","or","CNN","networks",",","and","not","for","RNN","networks",".","Implementations","of","attention","mechanisms","should","inherit","from","this","class",",","and","reuse","the","`","apply_attention_scores","(",")","`","method",".","Args",":","causal",":","Boolean",".","Set","to","`","True","`","for","decoder","self-attention",".","Adds","a","mask","such","that","position","`","i","`","can","not","attend","to","positions","`","j",">","i","`",".","This","prevents","the","flow","of","information","from","the","future","towards","the","past",".","dropout",":","Float","between","0","and","1",".","Fraction","of","the","units","to","drop","for","the","attention","scores",".","Call","Args",":","inputs",":","List","of","the","following","tensors",":","*","query",":","Query","`","Tensor","`","of","shape","`","[","batch_size",",","Tq",",","dim","]","`",".","*","value",":","Value","`","Tensor","`","of","shape","`","[","batch_size",",","Tv",",","dim","]","`",".","*","key",":","Optional","key","`","Tensor","`","of","shape","`","[","batch_size",",","Tv",",","dim","]","`",".","If","not","given",",","will","use","`","value","`","for","both","`","key","`","and","`","value","`",",","which","is","the","most","common","case",".","mask",":","List","of","the","following","tensors",":","*","query_mask",":","A","boolean","mask","`","Tensor","`","of","shape","`","[","batch_size",",","Tq","]","`",".","If","given",",","the","output","will","be","zero","at","the","positions","where","`","mask==False","`",".","*","value_mask",":","A","boolean","mask","`","Tensor","`","of","shape","`","[","batch_size",",","Tv","]","`",".","If","given",",","will","apply","the","mask","such","that","values","at","positions","where","`","mask==False","`","do","not","contribute","to","the","result",".","training",":","Python","boolean","indicating","whether","the","layer","should","behave","in","training","mode","(","adding","dropout",")","or","in","inference","mode","(","no","dropout",")",".","return_attention_scores",":","bool",",","it","`","True","`",",","returns","the","attention","scores","(","after","masking","and","softmax",")","as","an","additional","output","argument",".","Output",":","Attention","outputs","of","shape","`","[","batch_size",",","Tq",",","dim","]","`",".","[","Optional","]","Attention","scores","after","masking","and","softmax","with","shape","`","[","batch_size",",","Tq",",","Tv","]","`","."]
docstr: Validates arguments of the call method.
docstr_tok: ["Validates","arguments","of","the","call","method","."]
code: def _validate_call_args(self, inputs, mask):
      """Validates arguments of the call method."""
      class_name = self.__class__.__name__
      if not isinstance(inputs, list):
          raise ValueError(
              "{} layer must be called on a list of inputs, namely [query, value] "
              "or [query, value, key].".format(class_name)
          )
      if len(inputs) < 2 or len(inputs) > 3:
          raise ValueError(
              "{} layer accepts inputs list of length 2 or 3, "
              "namely [query, value] or [query, value, key]. "
              "Given length: {}".format(class_name, len(inputs))
          )
      if mask:
          if not isinstance(mask, list):
              raise ValueError(
                  "{} layer mask must be a list, "
                  "namely [query_mask, value_mask].".format(class_name)
              )
          if len(mask) < 2 or len(mask) > len(inputs):
              raise ValueError(
                  "{} layer mask must be a list of length 2, namely [query_mask, "
                  "value_mask]. Given length: {}".format(
                      class_name, len(mask)
                  )
              )
  
imports: from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import tensor_conversion
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.keras import backend
  from tensorflow.python.keras.engine.base_layer import Layer
  from tensorflow.python.keras.utils import control_flow_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import init_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn
label_desc: Use image node_id 6 for calling the BaseDenseAttention obj's underlying member method code with example usage: obj._validate_call_args(inputs, mask) without return types