class_docstr: NAIS is an attention network, which is capable of distinguishing which historical items
  in a user profile are more important for a prediction. We just implement the model following
  the original author with a pointwise training mode.
  
  Note:
      instead of forming a minibatch as all training instances of a randomly sampled user which is
      mentioned in the original paper, we still train the model by a randomly sampled interactions.
docstr: softmax the unmasked user history items and get the final output
  
  Args:
      similarity (torch.Tensor): the similarity between the history items and target items
      logits (torch.Tensor): the initial weights of the history items
      item_num (torch.Tensor): user history interaction lengths
      bias (torch.Tensor): bias
      batch_mask_mat (torch.Tensor): the mask of user history interactions
  
  Returns:
      torch.Tensor: final output
docstr_tok: ["softmax","the","unmasked","user","history","items","and","get","the","final","output","Args",":","similarity","(","torch.Tensor",")",":","the","similarity","between","the","history","items","and","target","items","logits","(","torch.Tensor",")",":","the","initial","weights","of","the","history","items","item_num","(","torch.Tensor",")",":","user","history","interaction","lengths","bias","(","torch.Tensor",")",":","bias","batch_mask_mat","(","torch.Tensor",")",":","the","mask","of","user","history","interactions","Returns",":","torch.Tensor",":","final","output"]
code: def mask_softmax(
      self, similarity, logits, bias, item_num, batch_mask_mat
  ):
      """softmax the unmasked user history items and get the final output
  
      Args:
          similarity (torch.Tensor): the similarity between the history items and target items
          logits (torch.Tensor): the initial weights of the history items
          item_num (torch.Tensor): user history interaction lengths
          bias (torch.Tensor): bias
          batch_mask_mat (torch.Tensor): the mask of user history interactions
  
      Returns:
          torch.Tensor: final output
  
      """
      exp_logits = torch.exp(logits)  # batch_size x max_len
  
      exp_logits = batch_mask_mat * exp_logits  # batch_size x max_len
      exp_sum = torch.sum(exp_logits, dim=1, keepdim=True)
      exp_sum = torch.pow(exp_sum, self.beta)
      weights = torch.div(exp_logits, exp_sum)
  
      coeff = torch.pow(item_num.squeeze(1), -self.alpha)
      output = (
          coeff.float() * torch.sum(weights * similarity, dim=1) + bias
      )
  
      return output
  
imports: import torch
  import torch.nn
  from torch.nn.init import constant_, normal_, xavier_normal_
  from recbole.model.abstract_recommender import GeneralRecommender
  from recbole.model.layers import MLPLayers
  from recbole.utils import InputType
label_desc: Use image node_id 7 for calling the NAIS obj's underlying member method code with example usage: obj.mask_softmax(similarity, logits, bias, item_num, batch_mask_mat) and returns: output