




"""simple docstring"""





from logging import getLogger
from typing import Any, Callable, List, Optional, Union

import numpy as np
import PIL
import torch

from ...schedulers import DDPMScheduler
from ..onnx_utils import ORT_TO_NP_TYPE, OnnxRuntimeModel
from ..pipeline_utils import ImagePipelineOutput
from . import StableDiffusionUpscalePipeline


_lowercase						   =     getLogger(__name__)


_lowercase						   =     4
_lowercase						   =     7

_lowercase						   =     {
    """float16""": torch.floataa,
    """float32""": torch.floataa,
}

def 		lowerCAmelCase				(			lowerCamelCase		):
						'''simple docstring'''


						if isinstance(lowerCamelCase   ,      torch.Tensor		):
												return image
						elif isinstance(lowerCamelCase   ,      PIL.Image.Image		):
												snake_case__							:       Tuple				      =       [image]

						if isinstance(image[0]   ,      PIL.Image.Image		):
												snake_case__      ,						snake_case__							:       int				      =       image[0].size
												snake_case__      ,						snake_case__							:       Dict				      =       (x - x % 64 for x in (w, h))  # resize to integer multiple of 32

												snake_case__							:       Optional[Any]				      =       [np.array(i.resize((w, h)		)		)[None, :] for i in image]
												snake_case__							:       str				      =       np.concatenate(lowerCamelCase   ,      axis=0		)
												snake_case__							:       int				      =       np.array(lowerCamelCase		).astype(np.floataa		) / 255.0
												snake_case__							:       str				      =       image.transpose(0   ,      3   ,      1   ,      2		)
												snake_case__							:       List[Any]				      =       2.0 * image - 1.0
												snake_case__							:       Union[str, Any]				      =       torch.from_numpy(lowerCamelCase		)
						elif isinstance(image[0]   ,      torch.Tensor		):
												snake_case__							:       Optional[int]				      =       torch.cat(lowerCamelCase   ,      dim=0		)

						return image

class    __lowercase							(      snake_case_						):


				'''simple docstring'''


				def __init__( self :  Dict   ,SCREAMING_SNAKE_CASE_ :  OnnxRuntimeModel   ,SCREAMING_SNAKE_CASE_ :  OnnxRuntimeModel   ,SCREAMING_SNAKE_CASE_ :  Any   ,SCREAMING_SNAKE_CASE_ :  OnnxRuntimeModel   ,SCREAMING_SNAKE_CASE_ :  DDPMScheduler   ,SCREAMING_SNAKE_CASE_ :  Any   ,SCREAMING_SNAKE_CASE_ :  int = 3_5_0   ,):
										super().__init__(
										    vae=SCREAMING_SNAKE_CASE_   ,text_encoder=SCREAMING_SNAKE_CASE_   ,tokenizer=SCREAMING_SNAKE_CASE_   ,unet=SCREAMING_SNAKE_CASE_   ,low_res_scheduler=SCREAMING_SNAKE_CASE_   ,scheduler=SCREAMING_SNAKE_CASE_   ,safety_checker=SCREAMING_SNAKE_CASE_   ,feature_extractor=SCREAMING_SNAKE_CASE_   ,watermarker=SCREAMING_SNAKE_CASE_   ,max_noise_level=SCREAMING_SNAKE_CASE_   ,)

				def __call__( self :  Optional[int]   ,SCREAMING_SNAKE_CASE_ :  Union[str, List[str]]   ,SCREAMING_SNAKE_CASE_ :  Union[torch.FloatTensor, PIL.Image.Image, List[PIL.Image.Image]]   ,SCREAMING_SNAKE_CASE_ :  int = 7_5   ,SCREAMING_SNAKE_CASE_ :  float = 9.0   ,SCREAMING_SNAKE_CASE_ :  int = 2_0   ,SCREAMING_SNAKE_CASE_ :  Optional[Union[str, List[str]]] = None   ,SCREAMING_SNAKE_CASE_ :  Optional[int] = 1   ,SCREAMING_SNAKE_CASE_ :  float = 0.0   ,SCREAMING_SNAKE_CASE_ :  Optional[Union[torch.Generator, List[torch.Generator]]] = None   ,SCREAMING_SNAKE_CASE_ :  Optional[torch.FloatTensor] = None   ,SCREAMING_SNAKE_CASE_ :  Optional[np.ndarray] = None   ,SCREAMING_SNAKE_CASE_ :  Optional[np.ndarray] = None   ,SCREAMING_SNAKE_CASE_ :  Optional[str] = "pil"   ,SCREAMING_SNAKE_CASE_ :  bool = True   ,SCREAMING_SNAKE_CASE_ :  Optional[Callable[[int, int, torch.FloatTensor], None]] = None   ,SCREAMING_SNAKE_CASE_ :  Optional[int] = 1   ,):
										self.check_inputs(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   )

										# 2. Define call parameters
										if prompt is not None and isinstance(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ):
																snake_case__							:       Tuple				      =       1
										elif prompt is not None and isinstance(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ):
																snake_case__							:       Union[str, Any]				      =       len(SCREAMING_SNAKE_CASE_   )
										else:
																snake_case__							:       Union[str, Any]				      =       prompt_embeds.shape[0]

										snake_case__							:       List[str]				      =       self._execution_device
										# here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
										# of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
										# corresponds to doing no classifier free guidance.
										snake_case__							:       Union[str, Any]				      =       guidance_scale > 1.0

										# 3. Encode input prompt
										snake_case__							:       Optional[int]				      =       self._encode_prompt(
										    SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,prompt_embeds=SCREAMING_SNAKE_CASE_   ,negative_prompt_embeds=SCREAMING_SNAKE_CASE_   ,)

										snake_case__							:       str				      =       ORT_TO_PT_TYPE[str(text_embeddings.dtype   )]

										# 4. Preprocess image
										snake_case__							:       str				      =       preprocess(SCREAMING_SNAKE_CASE_   )
										snake_case__							:       Any				      =       image.cpu()

										# 5. set timesteps
										self.scheduler.set_timesteps(SCREAMING_SNAKE_CASE_   ,device=SCREAMING_SNAKE_CASE_   )
										snake_case__							:       Any				      =       self.scheduler.timesteps

										# 5. Add noise to image
										snake_case__							:       Tuple				      =       torch.tensor([noise_level]   ,dtype=torch.long   ,device=SCREAMING_SNAKE_CASE_   )
										snake_case__							:       List[Any]				      =       torch.randn(image.shape   ,generator=SCREAMING_SNAKE_CASE_   ,device=SCREAMING_SNAKE_CASE_   ,dtype=SCREAMING_SNAKE_CASE_   )
										snake_case__							:       Any				      =       self.low_res_scheduler.add_noise(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   )

										snake_case__							:       str				      =       2 if do_classifier_free_guidance else 1
										snake_case__							:       List[Any]				      =       np.concatenate([image] * batch_multiplier * num_images_per_prompt   )
										snake_case__							:       Optional[Any]				      =       np.concatenate([noise_level] * image.shape[0]   )

										# 6. Prepare latent variables
										snake_case__      ,						snake_case__							:       Optional[int]				      =       image.shape[2:]
										snake_case__							:       Optional[int]				      =       self.prepare_latents(
										    batch_size * num_images_per_prompt   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,)

										# 7. Check that sizes of image and latents match
										snake_case__							:       Tuple				      =       image.shape[1]
										if NUM_LATENT_CHANNELS + num_channels_image != NUM_UNET_INPUT_CHANNELS:
																raise ValueError(
																    '''Incorrect configuration settings! The config of `pipeline.unet` expects'''
																    F''' {NUM_UNET_INPUT_CHANNELS} but received `num_channels_latents`: {NUM_LATENT_CHANNELS} +'''
																    F''' `num_channels_image`: {num_channels_image} '''
																    F''' = {NUM_LATENT_CHANNELS+num_channels_image}. Please verify the config of'''
																    ''' `pipeline.unet` or your `image` input.'''   )

										# 8. Prepare extra step kwargs. TODO: Logic should ideally just be moved out of the pipeline
										snake_case__							:       int				      =       self.prepare_extra_step_kwargs(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   )

										snake_case__							:       List[str]				      =       next(
										    (input.type for input in self.unet.model.get_inputs() if input.name == '''timestep''')   ,'''tensor(float)'''   )
										snake_case__							:       Union[str, Any]				      =       ORT_TO_NP_TYPE[timestep_dtype]

										# 9. Denoising loop
										snake_case__							:       Tuple				      =       len(SCREAMING_SNAKE_CASE_   ) - num_inference_steps * self.scheduler.order
										with self.progress_bar(total=SCREAMING_SNAKE_CASE_   ) as progress_bar:
																for i, t in enumerate(SCREAMING_SNAKE_CASE_   ):
																						# expand the latents if we are doing classifier free guidance
																						snake_case__							:       str				      =       np.concatenate([latents] * 2   ) if do_classifier_free_guidance else latents

																						# concat latents, mask, masked_image_latents in the channel dimension
																						snake_case__							:       Optional[int]				      =       self.scheduler.scale_model_input(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   )
																						snake_case__							:       Dict				      =       np.concatenate([latent_model_input, image]   ,axis=1   )

																						# timestep to tensor
																						snake_case__							:       Union[str, Any]				      =       np.array([t]   ,dtype=SCREAMING_SNAKE_CASE_   )

																						# predict the noise residual
																						snake_case__							:       Optional[Any]				      =       self.unet(
																						    sample=SCREAMING_SNAKE_CASE_   ,timestep=SCREAMING_SNAKE_CASE_   ,encoder_hidden_states=SCREAMING_SNAKE_CASE_   ,class_labels=noise_level.astype(np.intaa   )   ,)[0]

																						# perform guidance
																						if do_classifier_free_guidance:
																												snake_case__      ,						snake_case__							:       int				      =       np.split(SCREAMING_SNAKE_CASE_   ,2   )
																						snake_case__							:       str				      =       noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)

																						# compute the previous noisy sample x_t -> x_t-1
																						snake_case__							:       List[str]				      =       self.scheduler.step(
																						    torch.from_numpy(SCREAMING_SNAKE_CASE_   )   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,**SCREAMING_SNAKE_CASE_   ).prev_sample

																						# call the callback, if provided
																						if i == len(SCREAMING_SNAKE_CASE_   ) - 1 or ((i + 1) > num_warmup_steps and (i + 1) % self.scheduler.order == 0):
																												progress_bar.update()
																												if callback is not None and i % callback_steps == 0:
																																		callback(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   )

        # 10. Post-processing
										snake_case__							:       Dict				      =       self.decode_latents(latents.float()   )

										# 11. Convert to PIL
										if output_type == "pil":
																snake_case__							:       List[str]				      =       self.numpy_to_pil(SCREAMING_SNAKE_CASE_   )

										if not return_dict:
																return (image,)

										return ImagePipelineOutput(images=SCREAMING_SNAKE_CASE_   )

				def    _lowerCamelCase       ( self :  Optional[Any]   ,SCREAMING_SNAKE_CASE_ :  Dict   ):
										snake_case__							:       Optional[int]				      =       1 / 0.08333 * latents
										snake_case__							:       Any				      =       self.vae(latent_sample=SCREAMING_SNAKE_CASE_   )[0]
										snake_case__							:       Optional[Any]				      =       np.clip(image / 2 + 0.5   ,0   ,1   )
										snake_case__							:       Union[str, Any]				      =       image.transpose((0, 2, 3, 1)   )
										return image





				def    _lowerCamelCase       ( self :  Dict   ,SCREAMING_SNAKE_CASE_ :  Union[str, List[str]]   ,SCREAMING_SNAKE_CASE_ :  int   ,SCREAMING_SNAKE_CASE_ :  Optional[int]   ,SCREAMING_SNAKE_CASE_ :  bool   ,SCREAMING_SNAKE_CASE_ :  Optional[str]   ,SCREAMING_SNAKE_CASE_ :  Optional[torch.FloatTensor] = None   ,SCREAMING_SNAKE_CASE_ :  Optional[torch.FloatTensor] = None   ,):
										if prompt is not None and isinstance(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ):
																snake_case__							:       List[str]				      =       1
										elif prompt is not None and isinstance(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ):
																snake_case__							:       Optional[Any]				      =       len(SCREAMING_SNAKE_CASE_   )
										else:
																snake_case__							:       Any				      =       prompt_embeds.shape[0]

										if prompt_embeds is None:
																snake_case__							:       List[str]				      =       self.tokenizer(
																    SCREAMING_SNAKE_CASE_   ,padding='''max_length'''   ,max_length=self.tokenizer.model_max_length   ,truncation=SCREAMING_SNAKE_CASE_   ,return_tensors='''pt'''   ,)
																snake_case__							:       str				      =       text_inputs.input_ids
																snake_case__							:       List[Any]				      =       self.tokenizer(SCREAMING_SNAKE_CASE_   ,padding='''longest'''   ,return_tensors='''pt'''   ).input_ids

																if untruncated_ids.shape[-1] >= text_input_ids.shape[-1] and not torch.equal(
																    SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ):
																						snake_case__							:       Any				      =       self.tokenizer.batch_decode(
																						    untruncated_ids[:, self.tokenizer.model_max_length - 1 : -1]   )
																						logger.warning(
																						    '''The following part of your input was truncated because CLIP can only handle sequences up to'''
																						    F''' {self.tokenizer.model_max_length} tokens: {removed_text}'''   )

																# no positional arguments to text_encoder
																snake_case__							:       List[Any]				      =       self.text_encoder(
																    input_ids=text_input_ids.int().to(SCREAMING_SNAKE_CASE_   )   ,)
																snake_case__							:       List[Any]				      =       prompt_embeds[0]

										snake_case__      ,						snake_case__      ,						snake_case__							:       Tuple				      =       prompt_embeds.shape
										# duplicate text embeddings for each generation per prompt, using mps friendly method
										snake_case__							:       Optional[Any]				      =       prompt_embeds.repeat(1   ,SCREAMING_SNAKE_CASE_   )
										snake_case__							:       Dict				      =       prompt_embeds.reshape(bs_embed * num_images_per_prompt   ,SCREAMING_SNAKE_CASE_   ,-1   )

										# get unconditional embeddings for classifier free guidance
										if do_classifier_free_guidance and negative_prompt_embeds is None:
																snake_case__							:       List[str]
																if negative_prompt is None:
																						snake_case__							:       Optional[Any]				      =       [''''''] * batch_size
																elif type(SCREAMING_SNAKE_CASE_   ) is not type(SCREAMING_SNAKE_CASE_   ):
																						raise TypeError(
																						    F'''`negative_prompt` should be the same type to `prompt`, but got {type(SCREAMING_SNAKE_CASE_   )} !='''
																						    F''' {type(SCREAMING_SNAKE_CASE_   )}.'''   )
																elif isinstance(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ):
																						snake_case__							:       int				      =       [negative_prompt]
																elif batch_size != len(SCREAMING_SNAKE_CASE_   ):
																						raise ValueError(
																						    F'''`negative_prompt`: {negative_prompt} has batch size {len(SCREAMING_SNAKE_CASE_   )}, but `prompt`:'''
																						    F''' {prompt} has batch size {batch_size}. Please make sure that passed `negative_prompt` matches'''
																						    ''' the batch size of `prompt`.'''   )
																else:
																						snake_case__							:       Tuple				      =       negative_prompt

																snake_case__							:       Dict				      =       text_input_ids.shape[-1]
																snake_case__							:       List[Any]				      =       self.tokenizer(
																    SCREAMING_SNAKE_CASE_   ,padding='''max_length'''   ,max_length=SCREAMING_SNAKE_CASE_   ,truncation=SCREAMING_SNAKE_CASE_   ,return_tensors='''pt'''   ,)

																# if hasattr(uncond_input, "attention_mask"):
																#     attention_mask = uncond_input.attention_mask.to(device)
																# else:
																#     attention_mask = None

																snake_case__							:       Optional[Any]				      =       self.text_encoder(
																    input_ids=uncond_input.input_ids.int().to(SCREAMING_SNAKE_CASE_   )   ,)
																snake_case__							:       Dict				      =       uncond_embeddings[0]

										if do_classifier_free_guidance:
																snake_case__							:       Optional[int]				      =       uncond_embeddings.shape[1]
																# duplicate unconditional embeddings for each generation per prompt, using mps friendly method
																snake_case__							:       int				      =       uncond_embeddings.repeat(1   ,SCREAMING_SNAKE_CASE_   )
																snake_case__							:       Any				      =       uncond_embeddings.reshape(batch_size * num_images_per_prompt   ,SCREAMING_SNAKE_CASE_   ,-1   )

																# For classifier free guidance, we need to do two forward passes.
																# Here we concatenate the unconditional and text embeddings into a single batch
																# to avoid doing two forward passes
																snake_case__							:       Optional[int]				      =       np.concatenate([uncond_embeddings, prompt_embeds]   )

										return prompt_embeds








"""simple docstring"""





import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import AutoConfig


_lowercase						   =     logging.get_logger(__name__)

_lowercase						   =     {
    """facebook/musicgen-small""": """https://huggingface.co/facebook/musicgen-small/resolve/main/config.json""",
    # See all Musicgen models at https://huggingface.co/models?filter=musicgen
}

class    __lowercase							(      snake_case_						):


				'''simple docstring'''


				_lowerCAmelCase						      ="musicgen_decoder"
				_lowerCAmelCase						      =["past_key_values"]

				def __init__( self :  List[str]   ,SCREAMING_SNAKE_CASE_ :  Dict=2_0_4_8   ,SCREAMING_SNAKE_CASE_ :  str=2_0_4_8   ,SCREAMING_SNAKE_CASE_ :  List[str]=2_4   ,SCREAMING_SNAKE_CASE_ :  int=4_0_9_6   ,SCREAMING_SNAKE_CASE_ :  List[Any]=1_6   ,SCREAMING_SNAKE_CASE_ :  Dict=0.0   ,SCREAMING_SNAKE_CASE_ :  Any=True   ,SCREAMING_SNAKE_CASE_ :  Any="gelu"   ,SCREAMING_SNAKE_CASE_ :  Tuple=1_0_2_4   ,SCREAMING_SNAKE_CASE_ :  Any=0.1   ,SCREAMING_SNAKE_CASE_ :  List[str]=0.0   ,SCREAMING_SNAKE_CASE_ :  Optional[Any]=0.0   ,SCREAMING_SNAKE_CASE_ :  Tuple=0.02   ,SCREAMING_SNAKE_CASE_ :  Optional[Any]=False   ,SCREAMING_SNAKE_CASE_ :  List[str]=4   ,SCREAMING_SNAKE_CASE_ :  str=2_0_4_8   ,SCREAMING_SNAKE_CASE_ :  str=2_0_4_8   ,SCREAMING_SNAKE_CASE_ :  Optional[int]=None   ,SCREAMING_SNAKE_CASE_ :  Tuple=False   ,**SCREAMING_SNAKE_CASE_ :  Union[str, Any]   ,):
										snake_case__							:       List[str]				      =       vocab_size
										snake_case__							:       List[str]				      =       max_position_embeddings
										snake_case__							:       List[Any]				      =       hidden_size
										snake_case__							:       Dict				      =       ffn_dim
										snake_case__							:       Union[str, Any]				      =       num_hidden_layers
										snake_case__							:       List[str]				      =       num_attention_heads
										snake_case__							:       Optional[Any]				      =       dropout
										snake_case__							:       Dict				      =       attention_dropout
										snake_case__							:       Union[str, Any]				      =       activation_dropout
										snake_case__							:       Dict				      =       activation_function
										snake_case__							:       Union[str, Any]				      =       initializer_factor
										snake_case__							:       List[str]				      =       layerdrop
										snake_case__							:       Any				      =       use_cache
										snake_case__							:       Tuple				      =       scale_embedding  # scale factor will be sqrt(d_model) if True
										snake_case__							:       Any				      =       num_codebooks
										super().__init__(
										    pad_token_id=SCREAMING_SNAKE_CASE_   ,bos_token_id=SCREAMING_SNAKE_CASE_   ,eos_token_id=SCREAMING_SNAKE_CASE_   ,tie_word_embeddings=SCREAMING_SNAKE_CASE_   ,**SCREAMING_SNAKE_CASE_   ,)







class    __lowercase							(      snake_case_						):


				'''simple docstring'''


				_lowerCAmelCase						      ="musicgen"
				_lowerCAmelCase						      =True

				def __init__( self :  Optional[Any]   ,**SCREAMING_SNAKE_CASE_ :  Dict   ):
										super().__init__(**SCREAMING_SNAKE_CASE_   )
										if "text_encoder" not in kwargs or "audio_encoder" not in kwargs or "decoder" not in kwargs:
																raise ValueError('''Config has to be initialized with text_encoder, audio_encoder and decoder config'''   )

										snake_case__							:       Optional[int]				      =       kwargs.pop('''text_encoder'''   )
										snake_case__							:       Optional[Any]				      =       text_encoder_config.pop('''model_type'''   )

										snake_case__							:       Union[str, Any]				      =       kwargs.pop('''audio_encoder'''   )
										snake_case__							:       Dict				      =       audio_encoder_config.pop('''model_type'''   )

										snake_case__							:       Optional[Any]				      =       kwargs.pop('''decoder'''   )

										snake_case__							:       Union[str, Any]				      =       AutoConfig.for_model(SCREAMING_SNAKE_CASE_   ,**SCREAMING_SNAKE_CASE_   )
										snake_case__							:       List[Any]				      =       AutoConfig.for_model(SCREAMING_SNAKE_CASE_   ,**SCREAMING_SNAKE_CASE_   )
										snake_case__							:       List[str]				      =       MusicgenDecoderConfig(**SCREAMING_SNAKE_CASE_   )
										snake_case__							:       Union[str, Any]				      =       True

				@classmethod
				def    _lowerCamelCase       ( cls :  Dict   ,SCREAMING_SNAKE_CASE_ :  PretrainedConfig   ,SCREAMING_SNAKE_CASE_ :  PretrainedConfig   ,SCREAMING_SNAKE_CASE_ :  MusicgenDecoderConfig   ,**SCREAMING_SNAKE_CASE_ :  str   ,):
										return cls(
										    text_encoder=text_encoder_config.to_dict()   ,audio_encoder=audio_encoder_config.to_dict()   ,decoder=decoder_config.to_dict()   ,**SCREAMING_SNAKE_CASE_   ,)





				def    _lowerCamelCase       ( self :  Optional[Any]   ):
										snake_case__							:       Optional[Any]				      =       copy.deepcopy(self.__dict__   )
										snake_case__							:       Any				      =       self.text_encoder.to_dict()
										snake_case__							:       Dict				      =       self.audio_encoder.to_dict()
										snake_case__							:       Dict				      =       self.decoder.to_dict()
										snake_case__							:       Optional[int]				      =       self.__class__.model_type
										return output


