docstr: Generate bidirectional attention mask for multi-head attention.
docstr_tok: ["Generate","bidirectional","attention","mask","for","multi-head","attention","."]
code: def get_bi_attention_mask(self, item_seq):
      """Generate bidirectional attention mask for multi-head attention."""
      attention_mask = (item_seq > 0).long()
      extended_attention_mask = attention_mask.unsqueeze(1).unsqueeze(
          2
      )  # torch.int64
      # bidirectional mask
      extended_attention_mask = extended_attention_mask.to(
          dtype=next(self.parameters()).dtype
      )  # fp16 compatibility
      extended_attention_mask = (
          1.0 - extended_attention_mask
      ) * -10000.0
      return extended_attention_mask
  
imports: import random
  import numpy
  import torch
  from torch import nn
  import torch.nn.functional
  import math
  import torch.nn.functional
  from recbole.model.abstract_recommender import SequentialRecommender
  from recbole.model.loss import BPRLoss
  from recbole.data.interaction import Interaction
label_desc: Use image node_id 6 for calling the FEARec obj's underlying member method code with example usage: obj.get_bi_attention_mask(item_seq) and returns: extended_attention_mask