




"""simple docstring"""






from typing import Optional, Union

import torch
from torch import nn

from ...configuration_utils import ConfigMixin, register_to_config
from ...models.modeling_utils import ModelMixin






class lowerCAmelCase__      (	lowercase,      lowercase		):






			'''simple docstring'''



			@register_to_config
			def __init__(    self    , lowercase = 768    , ):
							super().__init__()

							_lowerCamelCase	:     Dict       =       nn.Parameter(torch.zeros(1    , lowercase    )    )
							_lowerCamelCase	:     Union[str, Any]       =       nn.Parameter(torch.ones(1    , lowercase    )    )
			def    A_       (    self    , lowercase = None    , lowercase = None    , ):
							_lowerCamelCase	:     List[str]       =       nn.Parameter(self.mean.to(lowercase    ).to(lowercase    )    )
							_lowerCamelCase	:     Tuple       =       nn.Parameter(self.std.to(lowercase    ).to(lowercase    )    )
							return self
			def    A_       (    self    , lowercase    ):
							_lowerCamelCase	:     int       =       (embeds - self.mean) * 1.0 / self.std
							return embeds






			def    A_       (    self    , lowercase    ):
							_lowerCamelCase	:     Union[str, Any]       =       (embeds * self.std) + self.mean
							return embeds





"""simple docstring"""






from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
			if not (is_transformers_available() and is_torch_available() and is_transformers_version(""">=""", """4.25.0""")):
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			from ...utils.dummy_torch_and_transformers_objects import (
			    VersatileDiffusionDualGuidedPipeline,
			    VersatileDiffusionImageVariationPipeline,
			    VersatileDiffusionPipeline,
			    VersatileDiffusionTextToImagePipeline,
			)
else:
			from .modeling_text_unet import UNetFlatConditionModel
			from .pipeline_versatile_diffusion import VersatileDiffusionPipeline
			from .pipeline_versatile_diffusion_dual_guided import VersatileDiffusionDualGuidedPipeline
			from .pipeline_versatile_diffusion_image_variation import VersatileDiffusionImageVariationPipeline
			from .pipeline_versatile_diffusion_text_to_image import VersatileDiffusionTextToImagePipeline