class_docstr: Defines interpretable multi-head attention layer.
  
  Attributes:
    n_head: Number of heads
    d_k: Key/query dimensionality per head
    d_v: Value dimensionality
    dropout: Dropout rate to apply
    qs_layers: List of queries across heads
    ks_layers: List of keys across heads
    vs_layers: List of values across heads
    attention: Scaled dot product attention layer
    w_o: Output weight matrix to project internal state to the original TFT
      state size
class_docstr_tok: ["Defines","interpretable","multi-head","attention","layer",".","Attributes",":","n_head",":","Number","of","heads","d_k",":","Key\/query","dimensionality","per","head","d_v",":","Value","dimensionality","dropout",":","Dropout","rate","to","apply","qs_layers",":","List","of","queries","across","heads","ks_layers",":","List","of","keys","across","heads","vs_layers",":","List","of","values","across","heads","attention",":","Scaled","dot","product","attention","layer","w_o",":","Output","weight","matrix","to","project","internal","state","to","the","original","TFT","state","size"]
docstr: Initialises layer.
  
  Args:
    n_head: Number of heads
    d_model: TFT state dimensionality
    dropout: Dropout discard rate
docstr_tok: ["Initialises","layer",".","Args",":","n_head",":","Number","of","heads","d_model",":","TFT","state","dimensionality","dropout",":","Dropout","discard","rate"]
code: def __init__(self, n_head, d_model, dropout):
      """Initialises layer.
  
      Args:
        n_head: Number of heads
        d_model: TFT state dimensionality
        dropout: Dropout discard rate
      """
  
      self.n_head = n_head
      self.d_k = self.d_v = d_k = d_v = d_model // n_head
      self.dropout = dropout
  
      self.qs_layers = []
      self.ks_layers = []
      self.vs_layers = []
  
      # Use same value layer to facilitate interp
      vs_layer = Dense(d_v, use_bias=False)
  
      for _ in range(n_head):
          self.qs_layers.append(Dense(d_k, use_bias=False))
          self.ks_layers.append(Dense(d_k, use_bias=False))
          self.vs_layers.append(vs_layer)  # use same vs_layer
  
      self.attention = ScaledDotProductAttention()
      self.w_o = Dense(d_model, use_bias=False)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import gc
  import json
  import os
  import shutil
  import data_formatters.base
  import libs.utils
  import numpy
  import pandas
  import tensorflow
label_desc: Use image node_id 1 to create a new InterpretableMultiHeadAttention object  with example: obj = InterpretableMultiHeadAttention(n_head, d_model, dropout)