class_docstr: Attention Layer: input shape should be[batch_size, seq_length, feature_dim]
code: def call(self, inputs):
      rank = inputs.shape.ndims
      if rank != 3:
          raise ValueError(
              "inputs rank must be 3 for AttLayer"
              ", got{}, shape:{}".format(rank, inputs.shape)
          )
      batch_size = tf.shape(inputs)[0]
      seq_len = tf.shape(inputs)[1]
      if len(self.hidden_dim) > 0:
          hidden = []
          for i in range(0, self.head_num[0]):
              hidden_val = self.att_head(
                  inputs, self.hidden_dim[0], self.activation
              )
              hidden_val = tf.reshape(
                  hidden_val, [batch_size, seq_len, self.hidden_dim[0]]
              )
              hidden.append(hidden_val)
          h_1 = tf.concat(hidden, -1)
          for i in range(1, len(self.hidden_dim)):
              hidden = []
              for j in range(0, self.head_num[i]):
                  hidden_val = self.att_head(
                      h_1, self.hidden_dim[i], self.activation
                  )
                  hidden_val = tf.reshape(
                      hidden_val,
                      [batch_size, seq_len, self.hidden_dim[i]],
                  )
                  hidden.append(hidden_val)
              h_1 = tf.concat(hidden, -1)
      else:
          h1 = inputs
      out = []
      for i in range(0, self.head_num[-1]):
          out_val = self.att_head(
              h_1, self.out_dim, self.activation_out
          )
          out_val = tf.reshape(
              out_val, [batch_size, seq_len, self.out_dim]
          )
          out.append(out_val)
      out = tf.add_n(out) / self.head_num[-1]
      out = tf.reshape(out, [batch_size, seq_len, self.out_dim])
      out = tf.slice(out, [0, 0, 0], [batch_size, 1, self.out_dim])
      return tf.reshape(out, [batch_size, self.out_dim])
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import tensorflow
  from tensorflow.python.util import nest
label_desc: Use image node_id 2 for calling the AttLayer obj's underlying member method code with example usage: obj.call(inputs) and returns: tf