code: def get_source_prompt(self, bsz=None):
      input_tokens = (
          self.source_prompt_inputs.unsqueeze(0)
          .expand(bsz, -1)
          .to(self.t5.device)
      )
      temp_control = self.source_wte(input_tokens)
      past_key_values = self.source_control_trans(
          temp_control
      )  # bsz, seqlen, layer*emb
  
      bsz, seqlen, _ = past_key_values.shape
      past_key_values = past_key_values.view(
          bsz,
          seqlen,
          self.match_n_layer * 2,
          self.match_n_head,
          self.match_n_embd,
      )
      past_key_values = self.dropout(past_key_values)
      past_key_values = past_key_values.permute([2, 0, 3, 1, 4]).split(
          2
      )
  
      # Cross prefix
      temp_control_dec = self.source_wte_dec(input_tokens)
      past_key_values_dec = self.source_control_trans_dec(
          temp_control_dec
      )  # bsz, seqlen, layer*emb
  
      bsz, seqlen, _ = past_key_values_dec.shape
      past_key_values_dec = past_key_values_dec.view(
          bsz,
          seqlen,
          self.match_n_layer * 2,
          self.match_n_head,
          self.match_n_embd,
      )
      past_key_values_dec = self.dropout(past_key_values_dec)
      past_key_values_dec = past_key_values_dec.permute(
          [2, 0, 3, 1, 4]
      ).split(2)
  
      # Encoder prefix
      input_tokens_enc = (
          self.source_prompt_inputs.unsqueeze(0).expand(bsz, -1)
      ).to(self.t5.device)
      temp_control_enc = self.source_wte_enc(input_tokens_enc)
      past_key_values_enc = self.source_control_trans_enc(
          temp_control_enc
      )  # bsz, seqlen, layer*emb
  
      bsz_enc, seqlen, _ = past_key_values_enc.shape
      past_key_values_enc = past_key_values_enc.view(
          bsz_enc,
          seqlen,
          self.match_n_layer * 2,
          self.match_n_head,
          self.match_n_embd,
      )
      past_key_values_enc = self.dropout(past_key_values_enc)
      past_key_values_enc = past_key_values_enc.permute(
          [2, 0, 3, 1, 4]
      ).split(2)
  
      result = []
      for i, key_val in enumerate(past_key_values):
          temp = dict()
          temp["decoder_prompt"] = {
              "prev_key": key_val[0].contiguous(),
              "prev_value": key_val[1].contiguous(),
              "prev_key_padding_mask": torch.zeros(bsz, seqlen)
              .to(key_val.device)
              .bool()
              # bsz, prompt_len
          }
          key_val_dec = past_key_values_dec[i]
          temp["cross_attention_prompt"] = {
              "prev_key": key_val_dec[0].contiguous(),
              "prev_value": key_val_dec[1].contiguous(),
              "prev_key_padding_mask": torch.zeros(bsz, seqlen)
              .to(key_val_dec.device)
              .bool(),
          }
          key_val_enc = past_key_values_enc[i]
          temp["encoder_prompt"] = {
              "prev_key": key_val_enc[0].contiguous(),
              "prev_value": key_val_enc[1].contiguous(),
              "prev_key_padding_mask": torch.zeros(bsz_enc, seqlen)
              .to(key_val_enc.device)
              .bool(),
          }
          result.append(temp)
  
      return result
  
file_path: DeepKE/src/deepke/name_entity_re/cross/seq2seq/models.py
imports: import os
  from copy import deepcopy
  import torch
  from torch import nn
  from .modeling_t5 import T5ForConditionalGeneration
label_desc: Use image node_id 3 for calling the T5Prompt obj's underlying member method code with example usage: obj.get_source_prompt(bsz) and returns: result