class_docstr: Hierarchical text classification model with attention.
class_docstr_tok: ["Hierarchical","text","classification","model","with","attention","."]
code: def call(
      self, inputs, training=None, mask=None
  ):  # pylint: disable=too-many-locals
      input_x = tf.identity(inputs["input_x"], name="input_x")
      if self.use_dense_task:
          dense_input = inputs["input_dense"]
      if self.use_true_length:
          # [batch_size, max_doc_len, max_sen_len]
          input_hx = self.pad_to_hier_input_true_len(
              input_x,
              self.max_doc_len,
              self.max_sen_len,
              self.split_token,
              padding_token=self.padding_token,
          )
      else:
          # [batch_size, max_doc_len, max_sen_len]
          input_hx = self.pad_to_hier_input(
              input_x,
              self.max_doc_len,
              self.max_sen_len,
              padding_token=self.padding_token,
          )
  
      # [batch_size, max_doc_len]
      sen_lens = compute_sen_lens(
          input_hx, padding_token=self.padding_token
      )
      # [batch_size]
      doc_lens = compute_doc_lens(sen_lens)
      # [batch_size, max_doc_len, max_sen_len, 1]
      sen_mask = tf.expand_dims(
          tf.sequence_mask(
              sen_lens, self.max_sen_len, dtype=tf.float32
          ),
          axis=-1,
      )
  
      # [batch_size, max_doc_len, 1]
      doc_mask = tf.expand_dims(
          tf.sequence_mask(
              doc_lens, self.max_doc_len, dtype=tf.float32
          ),
          axis=-1,
      )
  
      # [batch_size, max_doc_len, max_sen_len, embed_len]
      out = self.embed(input_hx)
      if self.use_pretrained_model:
          input_px = self.get_pre_train_graph(input_x)
          input_px = tf.reshape(
              input_px,
              [
                  -1,
                  self.max_doc_len,
                  self.max_sen_len,
                  self.pretrained_model_dim,
              ],
          )
          out = tf.concat([out, input_px], axis=-1)
      out = self.embed_d(out, training=training)
      all_sen_encoder = tf.keras.layers.TimeDistributed(
          self.sen_encoder
      )
      # [batch_size, max_doc_len, features]
      out = all_sen_encoder(out, training=training, mask=sen_mask)
      # [batch_size, features]
      out = self.doc_encoder(out, training=training, mask=doc_mask)
  
      if self.use_dense_input:
          dense_out = self.dense_input_linear(dense_input)
          if self.only_dense_input:
              out = dense_out
          else:
              out = tf.keras.layers.Concatenate()([out, dense_out])
  
      # [batch_size, class_num]
      scores = self.final_dense(out)
  
      return scores
  
file_path: delta/delta/models/text_hierarchical_model.py
imports: import pickle
  from absl import logging
  import delta.compat
  import delta.utils
  import delta.layers
  from delta.layers.utils import cut_or_padding
  from delta.layers.utils import compute_sen_lens
  from delta.layers.utils import compute_doc_lens
  from delta.layers.utils import split_one_doc_to_true_len_sens
  from delta.models.text_cls_model import TextClassModel
  from delta.utils.register import registers
label_desc: Use image node_id 2 for calling the HierarchicalAttentionModel obj's underlying member method code with example usage: obj.call(inputs, training, mask) and returns: scores