code: def test_one_dim_feature_preprocessing(self):
      modalities_config = [
          self._image_modality_config,
          self._text_modality_config,
      ]
      config = MMFTransformer.Config(
          modalities=modalities_config, num_labels=2
      )
      mmft = build_model(config)
  
      sample_list = SampleList()
      sample_list.image = torch.rand(2, 256)
      sample_list.text = torch.randint(0, 512, (2, 128))
  
      transformer_input = mmft.preprocess_sample(sample_list)
      input_ids = transformer_input["input_ids"]
      self.assertEqual(input_ids["image"].dim(), 3)
      self.assertEqual(list(input_ids["image"].size()), [2, 1, 256])
  
      self.assertEqual(input_ids["text"].dim(), 2)
      self.assertEqual(list(input_ids["text"].size()), [2, 128])
  
      position_ids = transformer_input["position_ids"]
      test_utils.compare_tensors(
          position_ids["image"], torch.tensor([[0], [0]])
      )
      test_utils.compare_tensors(
          position_ids["text"],
          torch.arange(0, 128).unsqueeze(0).expand((2, 128)),
      )
  
      masks = transformer_input["masks"]
      masks = mmft._infer_masks(sample_list, input_ids)
      test_utils.compare_tensors(
          masks["image"], torch.tensor([[1], [1]])
      )
      test_utils.compare_tensors(
          masks["text"], torch.ones((2, 128)).long()
      )
  
      segment_ids = transformer_input["segment_ids"]
      test_utils.compare_tensors(
          segment_ids["image"], torch.tensor([[0], [0]])
      )
      test_utils.compare_tensors(
          segment_ids["text"], torch.ones((2, 128)).long()
      )
  
      mlm_labels = transformer_input["mlm_labels"]
      test_utils.compare_tensors(
          mlm_labels["combined_labels"],
          torch.full((2, 129), dtype=torch.long, fill_value=-1),
      )
  
imports: import gc
  import unittest
  import tests.test_utils
  import torch
  from mmf.common.sample import SampleList
  from mmf.models.mmf_transformer import MMFTransformer, MMFTransformerModalityConfig
  from mmf.models.transformers.heads.mlm import MLM
  from mmf.modules.encoders import EncoderFactory, IdentityEncoder, ImageEncoderFactory, ImageEncoderTypes, ResNet152ImageEncoder, TextEncoderFactory, TextEncoderTypes
  from mmf.utils.build import build_model
  from mmf.utils.configuration import Configuration
  from mmf.utils.env import setup_imports, teardown_imports
  from omegaconf import OmegaConf
  from tests.test_utils import skip_if_no_pytorchvideo
label_desc: Use image node_id 3 for calling the TestMMFTransformer obj's underlying member method code with example usage: obj.test_one_dim_feature_preprocessing() without return types