

import math
from typing import Optional

import numpy as np
import torch
from torch import nn

from .activations import get_activation






def  UpperCamelCase_(							_snake_case     :						torch.Tensor ,  _snake_case     :						int ,  _snake_case     :						bool = False ,  _snake_case     :						float = 1 ,  _snake_case     :						float = 1 ,  _snake_case     :						int = 10000 ,  ):




			"""simple docstring"""






			assert len(timesteps.shape			) == 1, "Timesteps should be a 1d-array"

			__a						   =embedding_dim // 2
			__a						   =-math.log(_snake_case			) * torch.arange(
			    start=0 ,  end=_snake_case ,  dtype=torch.floataa ,  device=timesteps.device			)
			__a						   =exponent / (half_dim - downscale_freq_shift)

			__a						   =torch.exp(_snake_case			)
			__a						   =timesteps[:, None].float() * emb[None, :]

			# scale embeddings
			__a						   =scale * emb

			# concat sine and cosine embeddings
			__a						   =torch.cat([torch.sin(_snake_case			), torch.cos(_snake_case			)] ,  dim=-1			)

			# flip sine and cosine embeddings
			if flip_sin_to_cos:
						__a						   =torch.cat([emb[:, half_dim:], emb[:, :half_dim]] ,  dim=-1			)

			# zero pad
			if embedding_dim % 2 == 1:
						__a						   =torch.nn.functional.pad(_snake_case ,  (0, 1, 0, 0)			)
			return emb






def  UpperCamelCase_(							_snake_case     :						str ,  _snake_case     :						int ,  _snake_case     :						str=False ,  _snake_case     :						Optional[Any]=0			):




			"""simple docstring"""






			__a						   =np.arange(_snake_case ,  dtype=np.floataa			)
			__a						   =np.arange(_snake_case ,  dtype=np.floataa			)
			__a						   =np.meshgrid(_snake_case ,  _snake_case			)  # here w goes first
			__a						   =np.stack(_snake_case ,  axis=0			)

			__a						   =grid.reshape([2, 1, grid_size, grid_size]			)
			__a						   =get_ad_sincos_pos_embed_from_grid(_snake_case ,  _snake_case			)
			if cls_token and extra_tokens > 0:
						__a						   =np.concatenate([np.zeros([extra_tokens, embed_dim]			), pos_embed] ,  axis=0			)
			return pos_embed






def  UpperCamelCase_(							_snake_case     :						Dict ,  _snake_case     :						List[Any]			):




			"""simple docstring"""






			if embed_dim % 2 != 0:
						raise ValueError('embed_dim must be divisible by 2'			)

			# use half of dimensions to encode grid_h
			__a						   =get_ad_sincos_pos_embed_from_grid(embed_dim // 2 ,  grid[0]			)  # (H*W, D/2)
			__a						   =get_ad_sincos_pos_embed_from_grid(embed_dim // 2 ,  grid[1]			)  # (H*W, D/2)

			__a						   =np.concatenate([emb_h, emb_w] ,  axis=1			)  # (H*W, D)
			return emb






def  UpperCamelCase_(							_snake_case     :						Tuple ,  _snake_case     :						str			):




			"""simple docstring"""






			if embed_dim % 2 != 0:
						raise ValueError('embed_dim must be divisible by 2'			)

			__a						   =np.arange(embed_dim // 2 ,  dtype=np.floataa			)
			omega /= embed_dim / 2.0
			__a						   =1.0 / 10000**omega  # (D/2,)

			__a						   =pos.reshape(-1			)  # (M,)
			__a						   =np.einsum('m,d->md' ,  _snake_case ,  _snake_case			)  # (M, D/2), outer product

			__a						   =np.sin(_snake_case			)  # (M, D/2)
			__a						   =np.cos(_snake_case			)  # (M, D/2)

			__a						   =np.concatenate([emb_sin, emb_cos] ,  axis=1			)  # (M, D)
			return emb






class 			__magic_name__					(    nn.Module   ):





			def __init__(	self      ,						__snake_case=224      ,						__snake_case=224      ,						__snake_case=16      ,						__snake_case=3      ,						__snake_case=768      ,						__snake_case=False      ,						__snake_case=True      ,						__snake_case=True      ,						)     ->				Any:




						'''simple docstring'''
						super().__init__()

						__a						   =(height // patch_size) * (width // patch_size)
						__a						   =flatten
						__a						   =layer_norm

						__a						   =nn.Convad(
						    __snake_case      ,						__snake_case      ,						kernel_size=(patch_size, patch_size)      ,						stride=__snake_case      ,						bias=__snake_case      )
						if layer_norm:
									__a						   =nn.LayerNorm(__snake_case      ,						elementwise_affine=__snake_case      ,						eps=1e-6      )
						else:
									__a						   =None

						__a						   =get_ad_sincos_pos_embed(__snake_case      ,						int(num_patches**0.5      )      )
						self.register_buffer('pos_embed'      ,						torch.from_numpy(__snake_case      ).float().unsqueeze(0      )      ,						persistent=__snake_case      )





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				List[Any]:




						'''simple docstring'''
						__a						   =self.proj(__snake_case      )
						if self.flatten:
									__a						   =latent.flatten(2      ).transpose(1      ,						2      )  # BCHW -> BNC
						if self.layer_norm:
									__a						   =self.norm(__snake_case      )
						return latent + self.pos_embed






class 			__magic_name__					(    nn.Module   ):





			def __init__(	self      ,						__snake_case      ,						__snake_case      ,						__snake_case = "silu"      ,						__snake_case = None      ,						__snake_case = None      ,						__snake_case=None      ,						)     ->				str:




						'''simple docstring'''
						super().__init__()

						__a						   =nn.Linear(__snake_case      ,						__snake_case      )

						if cond_proj_dim is not None:
									__a						   =nn.Linear(__snake_case      ,						__snake_case      ,						bias=__snake_case      )
						else:
									__a						   =None

						__a						   =get_activation(__snake_case      )

						if out_dim is not None:
									__a						   =out_dim
						else:
									__a						   =time_embed_dim
						__a						   =nn.Linear(__snake_case      ,						__snake_case      )

						if post_act_fn is None:
									__a						   =None
						else:
									__a						   =get_activation(__snake_case      )





			def 	__magic_name__					(	self      ,						__snake_case      ,						__snake_case=None      )     ->				int:




						'''simple docstring'''
						if condition is not None:
									__a						   =sample + self.cond_proj(__snake_case      )
						__a						   =self.linear_a(__snake_case      )

						if self.act is not None:
									__a						   =self.act(__snake_case      )

						__a						   =self.linear_a(__snake_case      )

						if self.post_act is not None:
									__a						   =self.post_act(__snake_case      )
						return sample






class 			__magic_name__					(    nn.Module   ):





			def __init__(	self      ,						__snake_case      ,						__snake_case      ,						__snake_case      )     ->				str:




						'''simple docstring'''
						super().__init__()
						__a						   =num_channels
						__a						   =flip_sin_to_cos
						__a						   =downscale_freq_shift





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				Union[str, Any]:




						'''simple docstring'''
						__a						   =get_timestep_embedding(
						    __snake_case      ,						self.num_channels      ,						flip_sin_to_cos=self.flip_sin_to_cos      ,						downscale_freq_shift=self.downscale_freq_shift      ,						)
						return t_emb






class 			__magic_name__					(    nn.Module   ):





			def __init__(	self      ,						__snake_case = 256      ,						__snake_case = 1.0      ,						__snake_case=True      ,						__snake_case=True      ,						__snake_case=False      )     ->				str:




						'''simple docstring'''
						super().__init__()
						__a						   =nn.Parameter(torch.randn(__snake_case      ) * scale      ,						requires_grad=__snake_case      )
						__a						   =log
						__a						   =flip_sin_to_cos

						if set_W_to_weight:
									# to delete later
									__a						   =nn.Parameter(torch.randn(__snake_case      ) * scale      ,						requires_grad=__snake_case      )

									__a						   =self.W





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				int:




						'''simple docstring'''
						if self.log:
									__a						   =torch.log(__snake_case      )

						__a						   =x[:, None] * self.weight[None, :] * 2 * np.pi

						if self.flip_sin_to_cos:
									__a						   =torch.cat([torch.cos(__snake_case      ), torch.sin(__snake_case      )]      ,						dim=-1      )
						else:
									__a						   =torch.cat([torch.sin(__snake_case      ), torch.cos(__snake_case      )]      ,						dim=-1      )
						return out






class 			__magic_name__					(    nn.Module   ):





			def __init__(	self      ,						__snake_case      ,						__snake_case      ,						__snake_case      ,						__snake_case      ,						)     ->				Optional[int]:




						'''simple docstring'''
						super().__init__()

						__a						   =height
						__a						   =width
						__a						   =num_embed
						__a						   =embed_dim

						__a						   =nn.Embedding(self.num_embed      ,						__snake_case      )
						__a						   =nn.Embedding(self.height      ,						__snake_case      )
						__a						   =nn.Embedding(self.width      ,						__snake_case      )





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				Optional[Any]:




						'''simple docstring'''
						__a						   =self.emb(__snake_case      )

						__a						   =self.height_emb(torch.arange(self.height      ,						device=index.device      ).view(1      ,						self.height      )      )

						# 1 x H x D -> 1 x H x 1 x D
						__a						   =height_emb.unsqueeze(2      )

						__a						   =self.width_emb(torch.arange(self.width      ,						device=index.device      ).view(1      ,						self.width      )      )

						# 1 x W x D -> 1 x 1 x W x D
						__a						   =width_emb.unsqueeze(1      )

						__a						   =height_emb + width_emb

						# 1 x H x W x D -> 1 x L xD
						__a						   =pos_emb.view(1      ,						self.height * self.width      ,						-1      )

						__a						   =emb + pos_emb[:, : emb.shape[1], :]

						return emb






class 			__magic_name__					(    nn.Module   ):





			def __init__(	self      ,						__snake_case      ,						__snake_case      ,						__snake_case      )     ->				Optional[Any]:




						'''simple docstring'''
						super().__init__()
						__a						   =dropout_prob > 0
						__a						   =nn.Embedding(num_classes + use_cfg_embedding      ,						__snake_case      )
						__a						   =num_classes
						__a						   =dropout_prob





			def 	__magic_name__					(	self      ,						__snake_case      ,						__snake_case=None      )     ->				Dict:




						'''simple docstring'''
						if force_drop_ids is None:
									__a						   =torch.rand(labels.shape[0]      ,						device=labels.device      ) < self.dropout_prob
						else:
									__a						   =torch.tensor(force_drop_ids == 1      )
						__a						   =torch.where(__snake_case      ,						self.num_classes      ,						__snake_case      )
						return labels





			def 	__magic_name__					(	self      ,						__snake_case      ,						__snake_case=None      )     ->				str:




						'''simple docstring'''
						__a						   =self.dropout_prob > 0
						if (self.training and use_dropout) or (force_drop_ids is not None):
									__a						   =self.token_drop(__snake_case      ,						__snake_case      )
						__a						   =self.embedding_table(__snake_case      )
						return embeddings






class 			__magic_name__					(    nn.Module   ):





			def __init__(	self      ,						__snake_case = 1024      ,						__snake_case = 768      ,						__snake_case = 768      ,						__snake_case = 10      ,						)     ->				Dict:




						'''simple docstring'''
						super().__init__()

						__a						   =num_image_text_embeds
						__a						   =nn.Linear(__snake_case      ,						self.num_image_text_embeds * cross_attention_dim      )
						__a						   =nn.Linear(__snake_case      ,						__snake_case      )





			def 	__magic_name__					(	self      ,						__snake_case      ,						__snake_case      )     ->				str:




						'''simple docstring'''
						__a						   =text_embeds.shape[0]

						# image
						__a						   =self.image_embeds(__snake_case      )
						__a						   =image_text_embeds.reshape(__snake_case      ,						self.num_image_text_embeds      ,						-1      )

						# text
						__a						   =self.text_proj(__snake_case      )

						return torch.cat([image_text_embeds, text_embeds]      ,						dim=1      )






class 			__magic_name__					(    nn.Module   ):





			def __init__(	self      ,						__snake_case = 768      ,						__snake_case = 768      ,						__snake_case = 32      ,						)     ->				int:




						'''simple docstring'''
						super().__init__()

						__a						   =num_image_text_embeds
						__a						   =nn.Linear(__snake_case      ,						self.num_image_text_embeds * cross_attention_dim      )
						__a						   =nn.LayerNorm(__snake_case      )





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				str:




						'''simple docstring'''
						__a						   =image_embeds.shape[0]

						# image
						__a						   =self.image_embeds(__snake_case      )
						__a						   =image_embeds.reshape(__snake_case      ,						self.num_image_text_embeds      ,						-1      )
						__a						   =self.norm(__snake_case      )
						return image_embeds






class 			__magic_name__					(    nn.Module   ):





			def __init__(	self      ,						__snake_case      ,						__snake_case      ,						__snake_case=0.1      )     ->				Tuple:




						'''simple docstring'''
						super().__init__()

						__a						   =Timesteps(num_channels=256      ,						flip_sin_to_cos=__snake_case      ,						downscale_freq_shift=1      )
						__a						   =TimestepEmbedding(in_channels=256      ,						time_embed_dim=__snake_case      )
						__a						   =LabelEmbedding(__snake_case      ,						__snake_case      ,						__snake_case      )





			def 	__magic_name__					(	self      ,						__snake_case      ,						__snake_case      ,						__snake_case=None      )     ->				Optional[int]:




						'''simple docstring'''
						__a						   =self.time_proj(__snake_case      )
						__a						   =self.timestep_embedder(timesteps_proj.to(dtype=__snake_case      )      )  # (N, D)

						__a						   =self.class_embedder(__snake_case      )  # (N, D)

						__a						   =timesteps_emb + class_labels  # (N, D)

						return conditioning






class 			__magic_name__					(    nn.Module   ):





			def __init__(	self      ,						__snake_case      ,						__snake_case      ,						__snake_case = 64      )     ->				str:




						'''simple docstring'''
						super().__init__()
						__a						   =nn.LayerNorm(__snake_case      )
						__a						   =AttentionPooling(__snake_case      ,						__snake_case      )
						__a						   =nn.Linear(__snake_case      ,						__snake_case      )
						__a						   =nn.LayerNorm(__snake_case      )





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				List[str]:




						'''simple docstring'''
						__a						   =self.norma(__snake_case      )
						__a						   =self.pool(__snake_case      )
						__a						   =self.proj(__snake_case      )
						__a						   =self.norma(__snake_case      )
						return hidden_states






class 			__magic_name__					(    nn.Module   ):





			def __init__(	self      ,						__snake_case = 768      ,						__snake_case = 768      ,						__snake_case = 1536      )     ->				Dict:




						'''simple docstring'''
						super().__init__()
						__a						   =nn.Linear(__snake_case      ,						__snake_case      )
						__a						   =nn.LayerNorm(__snake_case      )
						__a						   =nn.Linear(__snake_case      ,						__snake_case      )





			def 	__magic_name__					(	self      ,						__snake_case      ,						__snake_case      )     ->				List[str]:




						'''simple docstring'''
						__a						   =self.text_proj(__snake_case      )
						__a						   =self.text_norm(__snake_case      )

						# image
						__a						   =self.image_proj(__snake_case      )

						return time_image_embeds + time_text_embeds






class 			__magic_name__					(    nn.Module   ):





			def __init__(	self      ,						__snake_case = 768      ,						__snake_case = 1536      )     ->				List[str]:




						'''simple docstring'''
						super().__init__()
						__a						   =nn.Linear(__snake_case      ,						__snake_case      )
						__a						   =nn.LayerNorm(__snake_case      )





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				List[str]:




						'''simple docstring'''
						__a						   =self.image_proj(__snake_case      )
						__a						   =self.image_norm(__snake_case      )
						return time_image_embeds






class 			__magic_name__					(    nn.Module   ):





			def __init__(	self      ,						__snake_case = 768      ,						__snake_case = 1536      )     ->				Tuple:




						'''simple docstring'''
						super().__init__()
						__a						   =nn.Linear(__snake_case      ,						__snake_case      )
						__a						   =nn.LayerNorm(__snake_case      )
						__a						   =nn.Sequential(
						    nn.Convad(3      ,						16      ,						3      ,						padding=1      )      ,						nn.SiLU()      ,						nn.Convad(16      ,						16      ,						3      ,						padding=1      )      ,						nn.SiLU()      ,						nn.Convad(16      ,						32      ,						3      ,						padding=1      ,						stride=2      )      ,						nn.SiLU()      ,						nn.Convad(32      ,						32      ,						3      ,						padding=1      )      ,						nn.SiLU()      ,						nn.Convad(32      ,						96      ,						3      ,						padding=1      ,						stride=2      )      ,						nn.SiLU()      ,						nn.Convad(96      ,						96      ,						3      ,						padding=1      )      ,						nn.SiLU()      ,						nn.Convad(96      ,						256      ,						3      ,						padding=1      ,						stride=2      )      ,						nn.SiLU()      ,						nn.Convad(256      ,						4      ,						3      ,						padding=1      )      ,						)





			def 	__magic_name__					(	self      ,						__snake_case      ,						__snake_case      )     ->				Union[str, Any]:




						'''simple docstring'''
						__a						   =self.image_proj(__snake_case      )
						__a						   =self.image_norm(__snake_case      )
						__a						   =self.input_hint_block(__snake_case      )
						return time_image_embeds, hint






class 			__magic_name__					(    nn.Module   ):





			def __init__(	self      ,						__snake_case      ,						__snake_case      ,						__snake_case=None      )     ->				Optional[Any]:




						'''simple docstring'''
						super().__init__()
						__a						   =dtype
						__a						   =nn.Parameter(torch.randn(1      ,						__snake_case      ) / embed_dim**0.5      )
						__a						   =nn.Linear(__snake_case      ,						__snake_case      ,						dtype=self.dtype      )
						__a						   =nn.Linear(__snake_case      ,						__snake_case      ,						dtype=self.dtype      )
						__a						   =nn.Linear(__snake_case      ,						__snake_case      ,						dtype=self.dtype      )
						__a						   =num_heads
						__a						   =embed_dim // self.num_heads





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				str:




						'''simple docstring'''
						__a   ,					__a   ,					__a						   =x.size()

						def shape(__snake_case      ):
									# (bs, length, width) --> (bs, length, n_heads, dim_per_head)
									__a						   =x.view(__snake_case      ,						-1      ,						self.num_heads      ,						self.dim_per_head      )
									# (bs, length, n_heads, dim_per_head) --> (bs, n_heads, length, dim_per_head)
									__a						   =x.transpose(1      ,						2      )
									# (bs, n_heads, length, dim_per_head) --> (bs*n_heads, length, dim_per_head)
									__a						   =x.reshape(bs * self.num_heads      ,						-1      ,						self.dim_per_head      )
									# (bs*n_heads, length, dim_per_head) --> (bs*n_heads, dim_per_head, length)
									__a						   =x.transpose(1      ,						2      )
									return x

						__a						   =x.mean(dim=1      ,						keepdim=__snake_case      ) + self.positional_embedding.to(x.dtype      )
						__a						   =torch.cat([class_token, x]      ,						dim=1      )  # (bs, length+1, width)

						# (bs*n_heads, class_token_length, dim_per_head)
						__a						   =shape(self.q_proj(__snake_case      )      )
						# (bs*n_heads, length+class_token_length, dim_per_head)
						__a						   =shape(self.k_proj(__snake_case      )      )
						__a						   =shape(self.v_proj(__snake_case      )      )

						# (bs*n_heads, class_token_length, length+class_token_length):
						__a						   =1 / math.sqrt(math.sqrt(self.dim_per_head      )      )
						__a						   =torch.einsum('bct,bcs->bts'      ,						q * scale      ,						k * scale      )  # More stable with f16 than dividing afterwards
						__a						   =torch.softmax(weight.float()      ,						dim=-1      ).type(weight.dtype      )

						# (bs*n_heads, dim_per_head, class_token_length)
						__a						   =torch.einsum('bts,bcs->bct'      ,						__snake_case      ,						__snake_case      )

						# (bs, length+1, width)
						__a						   =a.reshape(__snake_case      ,						-1      ,						1      ).transpose(1      ,						2      )

						return a[:, 0, :]  # cls_token








# Lint as: python3
import sys
from collections.abc import Mapping
from typing import TYPE_CHECKING

import numpy as np
import pyarrow as pa

from .. import config
from ..utils.py_utils import map_nested
from .formatting import TensorFormatter


if TYPE_CHECKING:
						import tensorflow as tf






class 			__magic_name__					(    TensorFormatter[Mapping, 'tf.Tensor', Mapping]   ):





			def __init__(	self      ,						__snake_case=None      ,						**__snake_case      )     ->				Union[str, Any]:




						'''simple docstring'''
						super().__init__(features=__snake_case      )
						__a						   =tf_tensor_kwargs
						import tensorflow as tf  # noqa: import tf at initialization





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				int:




						'''simple docstring'''
						import tensorflow as tf

						if isinstance(__snake_case      ,						__snake_case      ) and column:
									if all(
									    isinstance(__snake_case      ,						tf.Tensor      ) and x.shape == column[0].shape and x.dtype == column[0].dtype for x in column      ):
												return tf.stack(__snake_case      )
									elif all(
									    isinstance(__snake_case      ,						(tf.Tensor, tf.RaggedTensor)      ) and x.ndim == 1 and x.dtype == column[0].dtype
									    for x in column      ):
												# only rag 1-D tensors, otherwise some dimensions become ragged even though they were consolidated
												return tf.ragged.stack(__snake_case      )

						return column





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				Any:




						'''simple docstring'''
						import tensorflow as tf

						if value is None:
									return value

						__a						   ={}

						if isinstance(__snake_case      ,						(np.number, np.ndarray)      ) and np.issubdtype(value.dtype      ,						np.integer      ):
									__a						   ={'dtype': tf.intaa}
						elif isinstance(__snake_case      ,						(np.number, np.ndarray)      ) and np.issubdtype(value.dtype      ,						np.floating      ):
									__a						   ={'dtype': tf.floataa}
						elif config.PIL_AVAILABLE and "PIL" in sys.modules:
									import PIL.Image

									if isinstance(__snake_case      ,						PIL.Image.Image      ):
												__a						   =np.asarray(__snake_case      )

						return tf.convert_to_tensor(__snake_case      ,						**{**default_dtype, **self.tf_tensor_kwargs}      )





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				Dict:




						'''simple docstring'''
						import tensorflow as tf

						# support for torch, tf, jax etc.
						if config.TORCH_AVAILABLE and "torch" in sys.modules:
									import torch

									if isinstance(__snake_case      ,						torch.Tensor      ):
												return self._tensorize(data_struct.detach().cpu().numpy()[()]      )
						if hasattr(__snake_case      ,						'__array__'      ) and not isinstance(__snake_case      ,						tf.Tensor      ):
									__a						   =data_struct.__array__()
						# support for nested types like struct of list of struct
						if isinstance(__snake_case      ,						np.ndarray      ):
									if data_struct.dtype == object:  # tf tensors cannot be instantied from an array of objects
												return self._consolidate([self.recursive_tensorize(__snake_case      ) for substruct in data_struct]      )
						elif isinstance(__snake_case      ,						(list, tuple)      ):
									return self._consolidate([self.recursive_tensorize(__snake_case      ) for substruct in data_struct]      )
						return self._tensorize(__snake_case      )





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				Optional[Any]:




						'''simple docstring'''
						return map_nested(self._recursive_tensorize      ,						__snake_case      ,						map_list=__snake_case      )





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				Mapping:




						'''simple docstring'''
						__a						   =self.numpy_arrow_extractor().extract_row(__snake_case      )
						__a						   =self.python_features_decoder.decode_row(__snake_case      )
						return self.recursive_tensorize(__snake_case      )





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				"tf.Tensor":




						'''simple docstring'''
						__a						   =self.numpy_arrow_extractor().extract_column(__snake_case      )
						__a						   =self.python_features_decoder.decode_column(__snake_case      ,						pa_table.column_names[0]      )
						__a						   =self.recursive_tensorize(__snake_case      )
						__a						   =self._consolidate(__snake_case      )
						return column





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				Mapping:




						'''simple docstring'''
						__a						   =self.numpy_arrow_extractor().extract_batch(__snake_case      )
						__a						   =self.python_features_decoder.decode_batch(__snake_case      )
						__a						   =self.recursive_tensorize(__snake_case      )
						for column_name in batch:
									__a						   =self._consolidate(batch[column_name]      )
						return batch






