code: def get_maxp(embd, mask):
      # (bs, ntok, embdim)
      # (bs, ntok) 1==token, 0==pad
      mask = mask.clone().to(dtype=torch.float32)
      all_pad_idxs = (mask == 0).all(dim=1)
      mask[mask == 0] = float("-inf")
      mask[mask == 1] = 0
      maxp = (embd + mask[..., None]).max(dim=1)[0]  # (bs, embdim)
      maxp[all_pad_idxs] = 0  # if there is not embeddings, use zeros
      return maxp
  
imports: import os
  import torch
  import torch.nn.functional
  from typing import Any, List, Dict
  from collections import OrderedDict
  from torch import nn
  from towhee.models.mdmmt.bert_mmt import BertMMT
label_desc: Use image node_id 1 for calling a global function with example usage: get_maxp(embd, mask) and returns: maxp