class_docstr: Test Stable Diffusion text-to-image pipeline for:
  
  - PyTorch to CoreML conversion via coremltools
  - Speed of CoreML runtime across several compute units
  - Integration with `diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.py`
  - Efficacy of the safety_checker
  - Affinity of the generated image with the original prompt via CLIP score
  - The bridge between Python and Swift CLI
  - The signal parity of Swift CLI generated image with that of Python CLI
docstr: Tests:
  - PyTorch to CoreML conversion via coremltools
docstr_tok: ["Tests",":","-","PyTorch","to","CoreML","conversion","via","coremltools"]
code: def test_torch_to_coreml_conversion(self):
      """Tests:
      - PyTorch to CoreML conversion via coremltools
      """
      with self.subTest(model="vae_decoder"):
          logger.info("Converting vae_decoder")
          torch2coreml.convert_vae_decoder(
              self.pytorch_pipe, self.cli_args
          )
          logger.info("Successfully converted vae_decoder")
  
      with self.subTest(model="unet"):
          logger.info("Converting unet")
          torch2coreml.convert_unet(self.pytorch_pipe, self.cli_args)
          logger.info("Successfully converted unet")
  
      with self.subTest(model="text_encoder"):
          logger.info("Converting text_encoder")
          torch2coreml.convert_text_encoder(
              self.pytorch_pipe, self.cli_args
          )
          logger.info("Successfully converted text_encoder")
  
      with self.subTest(model="safety_checker"):
          logger.info("Converting safety_checker")
          torch2coreml.convert_safety_checker(
              self.pytorch_pipe, self.cli_args
          )
          logger.info("Successfully converted safety_checker")
  
imports: import argparse
  import contextlib
  import coremltools
  from diffusers import StableDiffusionPipeline
  import json
  import logging
  import numpy
  import os
  import unittest
  from PIL import Image
  from statistics import median
  import tempfile
  import time
  import torch
  from python_coreml_stable_diffusion import torch2coreml, pipeline, coreml_model
label_desc: Use image node_id 3 for calling the TestStableDiffusionForTextToImage obj's underlying member method code with example usage: obj.test_torch_to_coreml_conversion() without return types