class_docstr: a MMPT wrapper class for MMBert style models.
  TODO: move isolated mask to a subclass.
docstr: helper function for mask, seg_ids and token_type_ids.
docstr_tok: ["helper","function","for","mask",",","seg_ids","and","token_type_ids","."]
code: def _mm_on_the_fly(self, cmasks, vmasks, attention_mask):
      """helper function for mask, seg_ids and token_type_ids."""
      if attention_mask is None:
          attention_mask = self._mm_attention_mask(cmasks, vmasks)
  
      """
          0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
          | first sequence    | second sequence |
          """
      token_type_ids = torch.cat(
          [
              torch.zeros(
                  (vmasks.size(0), vmasks.size(1) + 2),
                  dtype=torch.long,
                  device=vmasks.device,
              ),
              torch.ones(
                  (cmasks.size(0), cmasks.size(1) - 2),
                  dtype=torch.long,
                  device=cmasks.device,
              ),
          ],
          dim=1,
      )
      return attention_mask, token_type_ids
  
imports: import torch
  from torch import nn
  from .None import transformermodel
label_desc: Use image node_id 3 for calling the MMFusion obj's underlying member method code with example usage: obj._mm_on_the_fly(cmasks, vmasks, attention_mask) and returns: attention_mask,  token_type_ids