code: def convert_to_pt(self, image):
      image = np.array(image.convert("RGB"))
      image = image[None].transpose(0, 3, 1, 2)
      image = (
          torch.from_numpy(image).to(dtype=torch.float32) / 127.5 - 1.0
      )
      return image
  
imports: import gc
  import random
  import unittest
  import numpy
  import torch
  from PIL import Image
  from transformers import CLIPImageProcessor, CLIPVisionConfig
  from diffusers import AutoencoderKL, PaintByExamplePipeline, PNDMScheduler, UNet2DConditionModel
  from diffusers.pipelines.paint_by_example import PaintByExampleImageEncoder
  from diffusers.utils.testing_utils import enable_full_determinism, floats_tensor, load_image, nightly, require_torch_gpu, torch_device
  from ..pipeline_params import IMAGE_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS, IMAGE_GUIDED_IMAGE_INPAINTING_PARAMS
  from ..test_pipelines_common import PipelineTesterMixin
label_desc: Use image node_id 2 for calling the PaintByExamplePipelineFastTests obj's underlying member method code with example usage: obj.convert_to_pt(image) and returns: image