code: def get_image_embeddings(
      self, sample_list
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      image_data = self.preprocess_image(sample_list)
      # image_data shape B x 3 x 224 x 224, B x 1 x 2048
      src = self.image_encoder(image_data)
      # src shape B x 49 x 2048, B x 1 x 2048
      if isinstance(src, dict):
          src = src[0]
      # Image embedding
      pos_src = src.permute(0, 2, 1)  # B x 2048 x 49,
      image_pos_embd = self.image_pos_emb(
          pos_src.reshape(
              (
                  pos_src.shape[0],
                  pos_src.shape[1],
                  int(math.sqrt(pos_src.shape[2])),
                  int(math.sqrt(pos_src.shape[2])),
              )
          )
      )
      image_pos_embd = image_pos_embd.flatten(2).permute(2, 0, 1)
      src_reshaped = src.flatten(2).permute(1, 0, 2)
      image_proj = self.image_proj(src_reshaped)
      # image_proj shape 49 x B x 512 1 x B x 512
      image_emb = image_proj + image_pos_embd
  
      # Shared transformer
      image_proj_sec = self.shared_transformer(image_emb)
      # Project to shared space
      image_proj_sec = image_proj_sec.permute(1, 0, 2)
      image_pool = self.image_pool(
          image_proj_sec, image_proj_sec
      ).squeeze(1)
      if self.config.norm_img_embeddings:
          image_pool = torch.nn.functional.normalize(
              image_pool, 2, dim=1
          )
  
      return image_pool
  
imports: import math
  from copy import deepcopy
  from dataclasses import dataclass
  from typing import Any, Tuple
  import torch
  from mmf.common.registry import registry
  from mmf.models.base_model import BaseModel
  from mmf.modules.encoders import IdentityEncoder
  from mmf.modules.layers import AttnPool1d
  from mmf.utils.build import build_classifier_layer, build_image_encoder, build_text_encoder
  from mmf.utils.general import filter_grads
  from mmf.utils.modeling import get_bert_configured_parameters
  from mmf.utils.transform import transform_to_batch_sequence
  from omegaconf import MISSING
label_desc: Use image node_id 7 for calling the CMSharedTransformer obj's underlying member method code with example usage: obj.get_image_embeddings(sample_list) and returns: image_pool