


from typing import Optional, Tuple, Union

import tensorflow as tf

from ...activations_tf import ACTaFN
from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward
from ...modeling_tf_outputs import (
    TFBaseModelOutputWithNoAttention,
    TFBaseModelOutputWithPoolingAndNoAttention,
    TFSequenceClassifierOutput,
)
from ...modeling_tf_utils import TFPreTrainedModel, TFSequenceClassificationLoss, keras_serializable, unpack_inputs
from ...tf_utils import shape_list
from ...utils import logging
from .configuration_regnet import RegNetConfig


UpperCAmelCase    =					logging.get_logger(__name__)

# General docstring
UpperCAmelCase    =					"""RegNetConfig"""

# Base docstring
UpperCAmelCase    =					"""facebook/regnet-y-040"""
UpperCAmelCase    =					[1, 1088, 7, 7]

# Image classification docstring
UpperCAmelCase    =					"""facebook/regnet-y-040"""
UpperCAmelCase    =					"""tabby, tabby cat"""

UpperCAmelCase    =					[
    """facebook/regnet-y-040""",
    # See all regnet models at https://huggingface.co/models?filter=regnet
]







class lowerCAmelCase_		(				tf.keras.layers.Layer ):

 '''simple docstring'''

 def __init__(			self	,   _UpperCAmelCase	,   _UpperCAmelCase = 3	,   _UpperCAmelCase = 1	,   _UpperCAmelCase = 1	,   _UpperCAmelCase = "relu"	,   **_UpperCAmelCase	,   ):
       super().__init__(**_UpperCAmelCase      )
       # The padding and conv has been verified in
       # https://colab.research.google.com/gist/sayakpaul/854bc10eeaf21c9ee2119e0b9f3841a7/scratchpad.ipynb
       snake_case_ =   tf.keras.layers.ZeroPaddingaD(padding=kernel_size // 2      )
       snake_case_ =   tf.keras.layers.ConvaD(
           filters=_UpperCAmelCase	,   kernel_size=_UpperCAmelCase	,   strides=_UpperCAmelCase	,   padding='''VALID'''	,   groups=_UpperCAmelCase	,   use_bias=_UpperCAmelCase	,   name='''convolution'''	,   )
       snake_case_ =   tf.keras.layers.BatchNormalization(epsilon=1E-5	,   momentum=0.9	,   name='''normalization'''      )
       snake_case_ =   ACTaFN[activation] if activation is not None else tf.identity





 def 		UpperCamelCase__  (			self	,   _UpperCAmelCase      ):
       snake_case_ =   self.convolution(self.padding(_UpperCAmelCase      )      )
       snake_case_ =   self.normalization(_UpperCAmelCase      )
       snake_case_ =   self.activation(_UpperCAmelCase      )
       return hidden_state







class lowerCAmelCase_		(				tf.keras.layers.Layer ):

 '''simple docstring'''

 def __init__(			self	,   _UpperCAmelCase	,   **_UpperCAmelCase      ):
       super().__init__(**_UpperCAmelCase      )
       snake_case_ =   config.num_channels
       snake_case_ =   TFRegNetConvLayer(
           out_channels=config.embedding_size	,   kernel_size=3	,   stride=2	,   activation=config.hidden_act	,   name='''embedder'''	,   )





 def 		UpperCamelCase__  (			self	,   _UpperCAmelCase      ):
       snake_case_ =   shape_list(_UpperCAmelCase      )[1]
       if tf.executing_eagerly() and num_channels != self.num_channels:
             raise ValueError(
                 '''Make sure that the channel dimension of the pixel values match with the one set in the configuration.'''      )

       # When running on CPU, `tf.keras.layers.Conv2D` doesn't support `NCHW` format.
       # So change the input format from `NCHW` to `NHWC`.
       # shape = (batch_size, in_height, in_width, in_channels=num_channels)
       snake_case_ =   tf.transpose(_UpperCAmelCase	,   perm=(0, 2, 3, 1)      )
       snake_case_ =   self.embedder(_UpperCAmelCase      )
       return hidden_state







class lowerCAmelCase_		(				tf.keras.layers.Layer ):

 '''simple docstring'''

 def __init__(			self	,   _UpperCAmelCase	,   _UpperCAmelCase = 2	,   **_UpperCAmelCase      ):
       super().__init__(**_UpperCAmelCase      )
       snake_case_ =   tf.keras.layers.ConvaD(
           filters=_UpperCAmelCase	,   kernel_size=1	,   strides=_UpperCAmelCase	,   use_bias=_UpperCAmelCase	,   name='''convolution'''      )
       snake_case_ =   tf.keras.layers.BatchNormalization(epsilon=1E-5	,   momentum=0.9	,   name='''normalization'''      )





 def 		UpperCamelCase__  (			self	,   _UpperCAmelCase	,   _UpperCAmelCase = False      ):
       return self.normalization(self.convolution(_UpperCAmelCase      )	,   training=_UpperCAmelCase      )







class lowerCAmelCase_		(				tf.keras.layers.Layer ):

 '''simple docstring'''

 def __init__(			self	,   _UpperCAmelCase	,   _UpperCAmelCase	,   **_UpperCAmelCase      ):
       super().__init__(**_UpperCAmelCase      )
       snake_case_ =   tf.keras.layers.GlobalAveragePoolingaD(keepdims=_UpperCAmelCase	,   name='''pooler'''      )
       snake_case_ =   [
           tf.keras.layers.ConvaD(filters=_UpperCAmelCase	,   kernel_size=1	,   activation='''relu'''	,   name='''attention.0'''      ),
           tf.keras.layers.ConvaD(filters=_UpperCAmelCase	,   kernel_size=1	,   activation='''sigmoid'''	,   name='''attention.2'''      ),
       ]





 def 		UpperCamelCase__  (			self	,   _UpperCAmelCase      ):
       # [batch_size, h, w, num_channels] -> [batch_size, 1, 1, num_channels]
       snake_case_ =   self.pooler(_UpperCAmelCase      )
       for layer_module in self.attention:
             snake_case_ =   layer_module(_UpperCAmelCase      )
       snake_case_ =   hidden_state * pooled
       return hidden_state







class lowerCAmelCase_		(				tf.keras.layers.Layer ):

 '''simple docstring'''

 def __init__(			self	,   _UpperCAmelCase	,   _UpperCAmelCase	,   _UpperCAmelCase	,   _UpperCAmelCase = 1	,   **_UpperCAmelCase      ):
       super().__init__(**_UpperCAmelCase      )
       snake_case_ =   in_channels != out_channels or stride != 1
       snake_case_ =   max(1	,   out_channels // config.groups_width      )
       snake_case_ =   (
           TFRegNetShortCut(_UpperCAmelCase	,   stride=_UpperCAmelCase	,   name='''shortcut'''      )
           if should_apply_shortcut
           else tf.keras.layers.Activation('''linear'''	,   name='''shortcut'''      )
       )
       # `self.layers` instead of `self.layer` because that is a reserved argument.
       snake_case_ =   [
           TFRegNetConvLayer(_UpperCAmelCase	,   kernel_size=1	,   activation=config.hidden_act	,   name='''layer.0'''      ),
           TFRegNetConvLayer(
               _UpperCAmelCase	,   stride=_UpperCAmelCase	,   groups=_UpperCAmelCase	,   activation=config.hidden_act	,   name='''layer.1'''      ),
           TFRegNetConvLayer(_UpperCAmelCase	,   kernel_size=1	,   activation=_UpperCAmelCase	,   name='''layer.2'''      ),
       ]
       snake_case_ =   ACTaFN[config.hidden_act]





 def 		UpperCamelCase__  (			self	,   _UpperCAmelCase      ):
       snake_case_ =   hidden_state
       for layer_module in self.layers:
             snake_case_ =   layer_module(_UpperCAmelCase      )
       snake_case_ =   self.shortcut(_UpperCAmelCase      )
       hidden_state += residual
       snake_case_ =   self.activation(_UpperCAmelCase      )
       return hidden_state







class lowerCAmelCase_		(				tf.keras.layers.Layer ):

 '''simple docstring'''

 def __init__(			self	,   _UpperCAmelCase	,   _UpperCAmelCase	,   _UpperCAmelCase	,   _UpperCAmelCase = 1	,   **_UpperCAmelCase      ):
       super().__init__(**_UpperCAmelCase      )
       snake_case_ =   in_channels != out_channels or stride != 1
       snake_case_ =   max(1	,   out_channels // config.groups_width      )
       snake_case_ =   (
           TFRegNetShortCut(_UpperCAmelCase	,   stride=_UpperCAmelCase	,   name='''shortcut'''      )
           if should_apply_shortcut
           else tf.keras.layers.Activation('''linear'''	,   name='''shortcut'''      )
       )
       snake_case_ =   [
           TFRegNetConvLayer(_UpperCAmelCase	,   kernel_size=1	,   activation=config.hidden_act	,   name='''layer.0'''      ),
           TFRegNetConvLayer(
               _UpperCAmelCase	,   stride=_UpperCAmelCase	,   groups=_UpperCAmelCase	,   activation=config.hidden_act	,   name='''layer.1'''      ),
           TFRegNetSELayer(_UpperCAmelCase	,   reduced_channels=int(round(in_channels / 4      )      )	,   name='''layer.2'''      ),
           TFRegNetConvLayer(_UpperCAmelCase	,   kernel_size=1	,   activation=_UpperCAmelCase	,   name='''layer.3'''      ),
       ]
       snake_case_ =   ACTaFN[config.hidden_act]





 def 		UpperCamelCase__  (			self	,   _UpperCAmelCase      ):
       snake_case_ =   hidden_state
       for layer_module in self.layers:
             snake_case_ =   layer_module(_UpperCAmelCase      )
       snake_case_ =   self.shortcut(_UpperCAmelCase      )
       hidden_state += residual
       snake_case_ =   self.activation(_UpperCAmelCase      )
       return hidden_state







class lowerCAmelCase_		(				tf.keras.layers.Layer ):

 '''simple docstring'''

 def __init__(			self	,   _UpperCAmelCase	,   _UpperCAmelCase	,   _UpperCAmelCase	,   _UpperCAmelCase = 2	,   _UpperCAmelCase = 2	,   **_UpperCAmelCase      ):
       super().__init__(**_UpperCAmelCase      )

       snake_case_ =   TFRegNetXLayer if config.layer_type == '''x''' else TFRegNetYLayer
       snake_case_ =   [
           # downsampling is done in the first layer with stride of 2
           layer(_UpperCAmelCase	,   _UpperCAmelCase	,   _UpperCAmelCase	,   stride=_UpperCAmelCase	,   name='''layers.0'''      ),
           *[layer(_UpperCAmelCase	,   _UpperCAmelCase	,   _UpperCAmelCase	,   name=F'''layers.{i+1}'''      ) for i in range(depth - 1      )],
       ]





 def 		UpperCamelCase__  (			self	,   _UpperCAmelCase      ):
       for layer_module in self.layers:
             snake_case_ =   layer_module(_UpperCAmelCase      )
       return hidden_state







class lowerCAmelCase_		(				tf.keras.layers.Layer ):

 '''simple docstring'''

 def __init__(			self	,   _UpperCAmelCase	,   **_UpperCAmelCase      ):
       super().__init__(**_UpperCAmelCase      )
       snake_case_ =   []
       # based on `downsample_in_first_stage`, the first layer of the first stage may or may not downsample the input
       self.stages.append(
           TFRegNetStage(
               _UpperCAmelCase	,   config.embedding_size	,   config.hidden_sizes[0]	,   stride=2 if config.downsample_in_first_stage else 1	,   depth=config.depths[0]	,   name='''stages.0'''	,   )      )
       snake_case_ =   zip(config.hidden_sizes	,   config.hidden_sizes[1:]      )
       for i, ((in_channels, out_channels), depth) in enumerate(zip(_UpperCAmelCase	,   config.depths[1:]      )      ):
             self.stages.append(TFRegNetStage(_UpperCAmelCase	,   _UpperCAmelCase	,   _UpperCAmelCase	,   depth=_UpperCAmelCase	,   name=F'''stages.{i+1}'''      )      )





 def 		UpperCamelCase__  (			self	,   _UpperCAmelCase	,   _UpperCAmelCase = False	,   _UpperCAmelCase = True      ):
       snake_case_ =   () if output_hidden_states else None

       for stage_module in self.stages:
             if output_hidden_states:
                   snake_case_ =   hidden_states + (hidden_state,)

             snake_case_ =   stage_module(_UpperCAmelCase      )

       if output_hidden_states:
             snake_case_ =   hidden_states + (hidden_state,)

       if not return_dict:
             return tuple(v for v in [hidden_state, hidden_states] if v is not None      )

       return TFBaseModelOutputWithNoAttention(last_hidden_state=_UpperCAmelCase	,   hidden_states=_UpperCAmelCase      )







@keras_serializable
class lowerCAmelCase_		(				tf.keras.layers.Layer ):

 '''simple docstring'''

 __snake_case				=						RegNetConfig



 def __init__(			self	,   _UpperCAmelCase	,   **_UpperCAmelCase      ):
       super().__init__(**_UpperCAmelCase      )
       snake_case_ =   config
       snake_case_ =   TFRegNetEmbeddings(_UpperCAmelCase	,   name='''embedder'''      )
       snake_case_ =   TFRegNetEncoder(_UpperCAmelCase	,   name='''encoder'''      )
       snake_case_ =   tf.keras.layers.GlobalAveragePoolingaD(keepdims=_UpperCAmelCase	,   name='''pooler'''      )





 @unpack_inputs
 def 		UpperCamelCase__  (			self	,   _UpperCAmelCase	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   _UpperCAmelCase = False	,   ):
       snake_case_ =   (
           output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
       )
       snake_case_ =   return_dict if return_dict is not None else self.config.use_return_dict

       snake_case_ =   self.embedder(_UpperCAmelCase	,   training=_UpperCAmelCase      )

       snake_case_ =   self.encoder(
           _UpperCAmelCase	,   output_hidden_states=_UpperCAmelCase	,   return_dict=_UpperCAmelCase	,   training=_UpperCAmelCase      )

       snake_case_ =   encoder_outputs[0]
       snake_case_ =   self.pooler(_UpperCAmelCase      )

       # Change to NCHW output format have uniformity in the modules
       snake_case_ =   tf.transpose(_UpperCAmelCase	,   perm=(0, 3, 1, 2)      )
       snake_case_ =   tf.transpose(_UpperCAmelCase	,   perm=(0, 3, 1, 2)      )

       # Change the other hidden state outputs to NCHW as well
       if output_hidden_states:
             snake_case_ =   tuple([tf.transpose(_UpperCAmelCase	,   perm=(0, 3, 1, 2)      ) for h in encoder_outputs[1]]      )

       if not return_dict:
             return (last_hidden_state, pooled_output) + encoder_outputs[1:]

       return TFBaseModelOutputWithPoolingAndNoAttention(
           last_hidden_state=_UpperCAmelCase	,   pooler_output=_UpperCAmelCase	,   hidden_states=hidden_states if output_hidden_states else encoder_outputs.hidden_states	,   )







class lowerCAmelCase_		(				lowerCamelCase__ ):

 '''simple docstring'''

 __snake_case				=						RegNetConfig
 __snake_case				=						"regnet"
 __snake_case				=						"pixel_values"



 @property
 def 		UpperCamelCase__  (			self      ):
       return {"pixel_values": tf.TensorSpec(shape=(None, self.config.num_channels, 2_24, 2_24)	,   dtype=tf.floataa      )}





UpperCAmelCase    =					r"""
    Parameters:
    This model is a Tensorflow
    [tf.keras.layers.Layer](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer) sub-class. Use it as a
    regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and
    behavior.
        config ([`RegNetConfig`]): Model configuration class with all the parameters of the model.
            Initializing with a config file does not load the weights associated with the model, only the
            configuration. Check out the [`~TFPreTrainedModel.from_pretrained`] method to load the model weights.
"""

UpperCAmelCase    =					r"""
    Args:
        pixel_values (`tf.Tensor` of shape `(batch_size, num_channels, height, width)`):
            Pixel values. Pixel values can be obtained using [`AutoImageProcessor`]. See
            [`ConveNextImageProcessor.__call__`] for details.
        output_hidden_states (`bool`, *optional*):
            Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
            more detail.
        return_dict (`bool`, *optional*):
            Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
"""







@add_start_docstrings(
    "The bare RegNet model outputting raw features without any specific head on top."      ,		lowerCamelCase__      ,		)
class lowerCAmelCase_		(				lowerCamelCase__ ):

 '''simple docstring'''

 def __init__(			self	,   _UpperCAmelCase	,   *_UpperCAmelCase	,   **_UpperCAmelCase      ):
       super().__init__(_UpperCAmelCase	,   *_UpperCAmelCase	,   **_UpperCAmelCase      )
       snake_case_ =   TFRegNetMainLayer(_UpperCAmelCase	,   name='''regnet'''      )





 @unpack_inputs
 @add_start_docstrings_to_model_forward(_UpperCAmelCase      )
 @add_code_sample_docstrings(
     checkpoint=_CHECKPOINT_FOR_DOC	,   output_type=_UpperCAmelCase	,   config_class=_CONFIG_FOR_DOC	,   modality='''vision'''	,   expected_output=_EXPECTED_OUTPUT_SHAPE	,   )
 def 		UpperCamelCase__  (			self	,   _UpperCAmelCase	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   _UpperCAmelCase=False	,   ):
       snake_case_ =   (
           output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
       )
       snake_case_ =   return_dict if return_dict is not None else self.config.use_return_dict

       snake_case_ =   self.regnet(
           pixel_values=_UpperCAmelCase	,   output_hidden_states=_UpperCAmelCase	,   return_dict=_UpperCAmelCase	,   training=_UpperCAmelCase	,   )
       if not return_dict:
             return (outputs[0],) + outputs[1:]

       return TFBaseModelOutputWithPoolingAndNoAttention(
           last_hidden_state=outputs.last_hidden_state	,   pooler_output=outputs.pooler_output	,   hidden_states=outputs.hidden_states	,   )







@add_start_docstrings(
    "\n    RegNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for\n    ImageNet.\n    "      ,		lowerCamelCase__      ,		)
class lowerCAmelCase_		(				lowerCamelCase__      ,		lowerCamelCase__ ):

 '''simple docstring'''

 def __init__(			self	,   _UpperCAmelCase	,   *_UpperCAmelCase	,   **_UpperCAmelCase      ):
       super().__init__(_UpperCAmelCase	,   *_UpperCAmelCase	,   **_UpperCAmelCase      )
       snake_case_ =   config.num_labels
       snake_case_ =   TFRegNetMainLayer(_UpperCAmelCase	,   name='''regnet'''      )
       # classification head
       snake_case_ =   [
           tf.keras.layers.Flatten(),
           tf.keras.layers.Dense(config.num_labels	,   name='''classifier.1'''      ) if config.num_labels > 0 else tf.identity,
       ]





 @unpack_inputs
 @add_start_docstrings_to_model_forward(_UpperCAmelCase      )
 @add_code_sample_docstrings(
     checkpoint=_IMAGE_CLASS_CHECKPOINT	,   output_type=_UpperCAmelCase	,   config_class=_CONFIG_FOR_DOC	,   expected_output=_IMAGE_CLASS_EXPECTED_OUTPUT	,   )
 def 		UpperCamelCase__  (			self	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   _UpperCAmelCase=False	,   ):
       snake_case_ =   (
           output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
       )
       snake_case_ =   return_dict if return_dict is not None else self.config.use_return_dict

       snake_case_ =   self.regnet(
           _UpperCAmelCase	,   output_hidden_states=_UpperCAmelCase	,   return_dict=_UpperCAmelCase	,   training=_UpperCAmelCase      )

       snake_case_ =   outputs.pooler_output if return_dict else outputs[1]

       snake_case_ =   self.classifier[0](_UpperCAmelCase      )
       snake_case_ =   self.classifier[1](_UpperCAmelCase      )

       snake_case_ =   None if labels is None else self.hf_compute_loss(labels=_UpperCAmelCase	,   logits=_UpperCAmelCase      )

       if not return_dict:
             snake_case_ =   (logits,) + outputs[2:]
             return ((loss,) + output) if loss is not None else output

       return TFSequenceClassifierOutput(loss=_UpperCAmelCase	,   logits=_UpperCAmelCase	,   hidden_states=outputs.hidden_states      )



from dataclasses import dataclass
from typing import Optional, Tuple

import torch
from torch import nn
from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel
from transformers.utils import ModelOutput







@dataclass
class lowerCAmelCase_		(				lowerCamelCase__ ):

 '''simple docstring'''

 __snake_case				=						None
 __snake_case				=						None
 __snake_case				=						None
 __snake_case				=						None







class lowerCAmelCase_		(				lowerCamelCase__ ):

 '''simple docstring'''

 def __init__(			self	,   _UpperCAmelCase=1	,   _UpperCAmelCase=0	,   _UpperCAmelCase=2	,   _UpperCAmelCase=5_12	,   _UpperCAmelCase="cls"	,   _UpperCAmelCase=False	,   _UpperCAmelCase=True	,   **_UpperCAmelCase	,   ):
       super().__init__(pad_token_id=_UpperCAmelCase	,   bos_token_id=_UpperCAmelCase	,   eos_token_id=_UpperCAmelCase	,   **_UpperCAmelCase      )
       snake_case_ =   project_dim
       snake_case_ =   pooler_fn
       snake_case_ =   learn_encoder
       snake_case_ =   use_attention_mask







class lowerCAmelCase_		(				lowerCamelCase__ ):

 '''simple docstring'''

 __snake_case				=						[R"pooler", R"logit_scale"]
 __snake_case				=						[R"position_ids", R"predictions.decoder.bias"]
 __snake_case				=						"roberta"
 __snake_case				=						RobertaSeriesConfig



 def __init__(			self	,   _UpperCAmelCase      ):
       super().__init__(_UpperCAmelCase      )
       snake_case_ =   XLMRobertaModel(_UpperCAmelCase      )
       snake_case_ =   nn.Linear(config.hidden_size	,   config.project_dim      )
       snake_case_ =   getattr(_UpperCAmelCase	,   '''has_pre_transformation'''	,   _UpperCAmelCase      )
       if self.has_pre_transformation:
             snake_case_ =   nn.Linear(config.hidden_size	,   config.project_dim      )
             snake_case_ =   nn.LayerNorm(config.hidden_size	,   eps=config.layer_norm_eps      )
       self.post_init()





 def 		UpperCamelCase__  (			self	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   _UpperCAmelCase = None	,   ):
       snake_case_ =   return_dict if return_dict is not None else self.config.use_return_dict

       snake_case_ =   self.base_model(
           input_ids=_UpperCAmelCase	,   attention_mask=_UpperCAmelCase	,   token_type_ids=_UpperCAmelCase	,   position_ids=_UpperCAmelCase	,   head_mask=_UpperCAmelCase	,   inputs_embeds=_UpperCAmelCase	,   encoder_hidden_states=_UpperCAmelCase	,   encoder_attention_mask=_UpperCAmelCase	,   output_attentions=_UpperCAmelCase	,   output_hidden_states=True if self.has_pre_transformation else output_hidden_states	,   return_dict=_UpperCAmelCase	,   )

       if self.has_pre_transformation:
             snake_case_ =   outputs['''hidden_states'''][-2]
             snake_case_ =   self.pre_LN(_UpperCAmelCase      )
             snake_case_ =   self.transformation_pre(_UpperCAmelCase      )

             return TransformationModelOutput(
                 projection_state=_UpperCAmelCase	,   last_hidden_state=outputs.last_hidden_state	,   hidden_states=outputs.hidden_states	,   attentions=outputs.attentions	,   )
       else:
             snake_case_ =   self.transformation(outputs.last_hidden_state      )
             return TransformationModelOutput(
                 projection_state=_UpperCAmelCase	,   last_hidden_state=outputs.last_hidden_state	,   hidden_states=outputs.hidden_states	,   attentions=outputs.attentions	,   )