code: def get_prompt(self, batch_size):
      input_tokens = (
          self.prompt_inputs.unsqueeze(0)
          .expand(batch_size, -1)
          .to(self.device)
      )
  
      # encoder prompt
      encoder_embed = self.encoder_prompt_embed(input_tokens)
      past_key_values = self.encoder_mlp(
          encoder_embed
      )  # bsz, seqlen, layer*emb
      bsz, seqlen, _ = past_key_values.shape
      past_key_values = past_key_values.view(
          bsz,
          seqlen,
          self.bart_config.decoder_layers * 2,
          self.bart_config.decoder_attention_heads,
          self.bart_config.d_model
          // self.bart_config.decoder_attention_heads,
      )
      past_key_values = self.dropout(past_key_values)
      past_key_values = past_key_values.permute([2, 0, 3, 1, 4]).split(
          2
      )  # key + value
  
      # decoder prompt
      decoder_embed = self.decoder_prompt_embed(input_tokens)
      past_key_values2 = self.decoder_mlp(
          decoder_embed
      )  # bsz, seqlen, layer*emb
      past_key_values2 = past_key_values2.view(
          bsz,
          seqlen,
          self.bart_config.decoder_layers * 2,
          self.bart_config.decoder_attention_heads,
          self.bart_config.d_model
          // self.bart_config.decoder_attention_heads,
      )
      past_key_values2 = self.dropout(past_key_values2)
      past_key_values2 = past_key_values2.permute(
          [2, 0, 3, 1, 4]
      ).split(2)
  
      # cross prompt
      cross_embed = self.prompt_cross_embed(input_tokens)
      past_key_values_enc = self.cross_mlp(
          cross_embed
      )  # bsz, seqlen, layer*emb
      past_key_values_enc = past_key_values_enc.view(
          bsz,
          seqlen,
          self.bart_config.decoder_layers * 2,
          self.bart_config.decoder_attention_heads,
          self.bart_config.d_model
          // self.bart_config.decoder_attention_heads,
      )
      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 = {
              "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(),
              },
          }
          key_val_dec = past_key_values2[i]
          temp_dict["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_dict["encoder_prompt"] = {
              "prev_key": key_val_enc[0].contiguous(),
              "prev_value": key_val_enc[1].contiguous(),
              "prev_key_padding_mask": torch.zeros(bsz, seqlen)
              .to(key_val_enc.device)
              .bool(),
          }
          result.append(temp_dict)
  
      return result
  
imports: import torch
  from torch import nn
  from torch.nn import functional
  from transformers.models.bart.configuration_bart import BartConfig
  from .modeling_bart import BartModel
  from ..utils.util import avg_token_embeddings, seq_to_mask, get_model_device
  from functools import partial
  from typing import Union
label_desc: Use image node_id 4 for calling the PromptBartModel obj's underlying member method code with example usage: obj.get_prompt(batch_size) and returns: result