class_docstr: Transformer backend wih Huggingface transformer models
class_docstr_tok: ["Transformer","backend","wih","Huggingface","transformer","models"]
docstr: Generate attention mask.
docstr_tok: ["Generate","attention","mask","."]
code: def generate_attention_mask(self, masks: List[Tensor]) -> Tensor:
      """Generate attention mask."""
      attention_mask = torch.cat(masks, dim=-1)
      extended_attention_mask = attention_mask.unsqueeze(1).unsqueeze(2)
      extended_attention_mask = (
          1.0 - extended_attention_mask
      ) * -10000.0
  
      return extended_attention_mask
  
imports: from copy import deepcopy
  from typing import Any, Dict, List, Type
  import torch
  from mmf.common.registry import registry
  from mmf.models.transformers.base import BaseTransformer, BaseTransformerBackend
  from mmf.modules.hf_layers import BertModelJit, replace_with_jit
  from omegaconf import OmegaConf
  from torch import nn, Tensor
label_desc: Use image node_id 7 for calling the HuggingfaceBackend obj's underlying member method code with example usage: obj.generate_attention_mask(masks) and returns: extended_attention_mask