


'''simple docstring'''

import unittest
from dataclasses import dataclass
from typing import List, Union

import numpy as np
import PIL.Image

from diffusers.utils.outputs import BaseOutput





@dataclass
class     __SCREAMING_SNAKE_CASE       (   lowerCamelCase__			):
     UpperCAmelCase			       =					42







class     __SCREAMING_SNAKE_CASE       (   unittest.TestCase			):






     def 			a_       (      self		)							->     int:
          _a            =		CustomOutput(images=np.random.rand(1  ,				3  ,				4  ,				4		)		)

          # check every way of getting the attribute
          assert isinstance(outputs.images  ,				np.ndarray		)
          assert outputs.images.shape == (1, 3, 4, 4)
          assert isinstance(outputs["images"]  ,				np.ndarray		)
          assert outputs["images"].shape == (1, 3, 4, 4)
          assert isinstance(outputs[0]  ,				np.ndarray		)
          assert outputs[0].shape == (1, 3, 4, 4)

          # test with a non-tensor attribute
          _a            =		CustomOutput(images=[PIL.Image.new("RGB"  ,				(4, 4)		)]		)

          # check every way of getting the attribute
          assert isinstance(outputs.images  ,				__UpperCamelCase		)
          assert isinstance(outputs.images[0]  ,				PIL.Image.Image		)
          assert isinstance(outputs["images"]  ,				__UpperCamelCase		)
          assert isinstance(outputs["images"][0]  ,				PIL.Image.Image		)
          assert isinstance(outputs[0]  ,				__UpperCamelCase		)
          assert isinstance(outputs[0][0]  ,				PIL.Image.Image		)






     def 			a_       (      self		)							->     Any:
          # test output reinitialization with a `dict` for compatibility with `accelerate`
          _a            =		CustomOutput({"images": np.random.rand(1  ,				3  ,				4  ,				4		)}		)

          # check every way of getting the attribute
          assert isinstance(outputs.images  ,				np.ndarray		)
          assert outputs.images.shape == (1, 3, 4, 4)
          assert isinstance(outputs["images"]  ,				np.ndarray		)
          assert outputs["images"].shape == (1, 3, 4, 4)
          assert isinstance(outputs[0]  ,				np.ndarray		)
          assert outputs[0].shape == (1, 3, 4, 4)

          # test with a non-tensor attribute
          _a            =		CustomOutput({"images": [PIL.Image.new("RGB"  ,				(4, 4)		)]}		)

          # check every way of getting the attribute
          assert isinstance(outputs.images  ,				__UpperCamelCase		)
          assert isinstance(outputs.images[0]  ,				PIL.Image.Image		)
          assert isinstance(outputs["images"]  ,				__UpperCamelCase		)
          assert isinstance(outputs["images"][0]  ,				PIL.Image.Image		)
          assert isinstance(outputs[0]  ,				__UpperCamelCase		)
          assert isinstance(outputs[0][0]  ,				PIL.Image.Image		)





'''simple docstring'''

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


lowercase__					  =		{
    "configuration_swin2sr": ["SWIN2SR_PRETRAINED_CONFIG_ARCHIVE_MAP", "Swin2SRConfig"],
}


try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowercase__					  =		[
       "SWIN2SR_PRETRAINED_MODEL_ARCHIVE_LIST",
       "Swin2SRForImageSuperResolution",
       "Swin2SRModel",
       "Swin2SRPreTrainedModel",
   ]


try:
   if not is_vision_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowercase__					  =		["Swin2SRImageProcessor"]


if TYPE_CHECKING:
   from .configuration_swinasr import SWIN2SR_PRETRAINED_CONFIG_ARCHIVE_MAP, SwinaSRConfig

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_swinasr import (
          SWIN2SR_PRETRAINED_MODEL_ARCHIVE_LIST,
          SwinaSRForImageSuperResolution,
          SwinaSRModel,
          SwinaSRPreTrainedModel,
      )

   try:
      if not is_vision_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .image_processing_swinasr import SwinaSRImageProcessor


else:
   import sys

   lowercase__					  =		_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)

