


"""simple docstring"""




from typing import Optional

import torch
import torch.utils.checkpoint
from torch import Tensor, nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss

from ...activations import ACTaFN
from ...modeling_outputs import (
    BackboneOutput,
    BaseModelOutputWithNoAttention,
    BaseModelOutputWithPoolingAndNoAttention,
    ImageClassifierOutputWithNoAttention,
)
from ...modeling_utils import PreTrainedModel
from ...utils import (
    add_code_sample_docstrings,
    add_start_docstrings,
    add_start_docstrings_to_model_forward,
    logging,
    replace_return_docstrings,
)
from ...utils.backbone_utils import BackboneMixin
from .configuration_resnet import ResNetConfig


_snake_case					:		str      =    logging.get_logger(__name__)

# General docstring
_snake_case					:		Dict      =    "ResNetConfig"

# Base docstring
_snake_case					:		List[str]      =    "microsoft/resnet-50"
_snake_case					:		List[Any]      =    [1, 2_048, 7, 7]

# Image classification docstring
_snake_case					:		str      =    "microsoft/resnet-50"
_snake_case					:		Union[str, Any]      =    "tiger cat"

_snake_case					:		int      =    [
    "microsoft/resnet-50",
    # See all resnet models at https://huggingface.co/models?filter=resnet
]

class     a		(nn.Module				):




							"""simple docstring"""


							def __init__(							self	:  Any   ,     lowerCamelCase	:  int   ,     lowerCamelCase	:  int   ,     lowerCamelCase	:  int = 3   ,     lowerCamelCase	:  int = 1   ,     lowerCamelCase	:  str = "relu"    )     ->   Union[str, Any]:
														super().__init__()
														__snake_case		:      Any										=       nn.Convad(
														    _lowerCamelCase   ,     _lowerCamelCase   ,     kernel_size=_lowerCamelCase   ,     stride=_lowerCamelCase   ,     padding=kernel_size // 2   ,     bias=_lowerCamelCase    )
														__snake_case		:      Any										=       nn.BatchNormad(_lowerCamelCase    )
														__snake_case		:      Union[str, Any]										=       ACTaFN[activation] if activation is not None else nn.Identity()






							def    __snake_case (							self	:  Union[str, Any]   ,     lowerCamelCase	:  Tensor    )     ->   Union[str, Any]:
														__snake_case		:      Optional[int]										=       self.convolution(_lowerCamelCase    )
														__snake_case		:      Any										=       self.normalization(_lowerCamelCase    )
														__snake_case		:      int										=       self.activation(_lowerCamelCase    )
														return hidden_state

class     a		(nn.Module				):




							"""simple docstring"""


							def __init__(							self	:  Any   ,     lowerCamelCase	:  ResNetConfig    )     ->   Any:
														super().__init__()
														__snake_case		:      Any										=       ResNetConvLayer(
														    config.num_channels   ,     config.embedding_size   ,     kernel_size=7   ,     stride=2   ,     activation=config.hidden_act    )
														__snake_case		:      int										=       nn.MaxPoolad(kernel_size=3   ,     stride=2   ,     padding=1    )
														__snake_case		:      List[str]										=       config.num_channels






							def    __snake_case (							self	:  Union[str, Any]   ,     lowerCamelCase	:  Tensor    )     ->   int:
														__snake_case		:      List[Any]										=       pixel_values.shape[1]
														if 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."    )
														__snake_case		:      Optional[int]										=       self.embedder(_lowerCamelCase    )
														__snake_case		:      int										=       self.pooler(_lowerCamelCase    )
														return embedding

class     a		(nn.Module				):




							"""simple docstring"""


							def __init__(							self	:  Optional[int]   ,     lowerCamelCase	:  int   ,     lowerCamelCase	:  int   ,     lowerCamelCase	:  int = 2    )     ->   Optional[Any]:
														super().__init__()
														__snake_case		:      Dict										=       nn.Convad(_lowerCamelCase   ,     _lowerCamelCase   ,     kernel_size=1   ,     stride=_lowerCamelCase   ,     bias=_lowerCamelCase    )
														__snake_case		:      Tuple										=       nn.BatchNormad(_lowerCamelCase    )






							def    __snake_case (							self	:  Dict   ,     lowerCamelCase	:  Tensor    )     ->   List[Any]:
														__snake_case		:      Any										=       self.convolution(_lowerCamelCase    )
														__snake_case		:      Dict										=       self.normalization(_lowerCamelCase    )
														return hidden_state

class     a		(nn.Module				):




							"""simple docstring"""


							def __init__(							self	:  Optional[int]   ,     lowerCamelCase	:  int   ,     lowerCamelCase	:  int   ,     lowerCamelCase	:  int = 1   ,     lowerCamelCase	:  str = "relu"    )     ->   Tuple:
														super().__init__()
														__snake_case		:      Optional[int]										=       in_channels != out_channels or stride != 1
														__snake_case		:      Optional[Any]										=       (
														    ResNetShortCut(_lowerCamelCase   ,     _lowerCamelCase   ,     stride=_lowerCamelCase    ) if should_apply_shortcut else nn.Identity()
														)
														__snake_case		:      Optional[Any]										=       nn.Sequential(
														    ResNetConvLayer(_lowerCamelCase   ,     _lowerCamelCase   ,     stride=_lowerCamelCase    )   ,     ResNetConvLayer(_lowerCamelCase   ,     _lowerCamelCase   ,     activation=_lowerCamelCase    )   ,     )
														__snake_case		:      Optional[int]										=       ACTaFN[activation]






							def    __snake_case (							self	:  Optional[int]   ,     lowerCamelCase	:  str    )     ->   List[Any]:
														__snake_case		:      List[str]										=       hidden_state
														__snake_case		:      int										=       self.layer(_lowerCamelCase    )
														__snake_case		:      str										=       self.shortcut(_lowerCamelCase    )
														hidden_state += residual
														__snake_case		:      Dict										=       self.activation(_lowerCamelCase    )
														return hidden_state

class     a		(nn.Module				):




							"""simple docstring"""


							def __init__(							self	:  List[Any]   ,     lowerCamelCase	:  int   ,     lowerCamelCase	:  int   ,     lowerCamelCase	:  int = 1   ,     lowerCamelCase	:  str = "relu"   ,     lowerCamelCase	:  int = 4    )     ->   Any:
														super().__init__()
														__snake_case		:      Dict										=       in_channels != out_channels or stride != 1
														__snake_case		:      Optional[Any]										=       out_channels // reduction
														__snake_case		:      Optional[int]										=       (
														    ResNetShortCut(_lowerCamelCase   ,     _lowerCamelCase   ,     stride=_lowerCamelCase    ) if should_apply_shortcut else nn.Identity()
														)
														__snake_case		:      Union[str, Any]										=       nn.Sequential(
														    ResNetConvLayer(_lowerCamelCase   ,     _lowerCamelCase   ,     kernel_size=1    )   ,     ResNetConvLayer(_lowerCamelCase   ,     _lowerCamelCase   ,     stride=_lowerCamelCase    )   ,     ResNetConvLayer(_lowerCamelCase   ,     _lowerCamelCase   ,     kernel_size=1   ,     activation=_lowerCamelCase    )   ,     )
														__snake_case		:      Union[str, Any]										=       ACTaFN[activation]






							def    __snake_case (							self	:  Dict   ,     lowerCamelCase	:  Optional[Any]    )     ->   Optional[int]:
														__snake_case		:      Optional[Any]										=       hidden_state
														__snake_case		:      Any										=       self.layer(_lowerCamelCase    )
														__snake_case		:      Dict										=       self.shortcut(_lowerCamelCase    )
														hidden_state += residual
														__snake_case		:      Union[str, Any]										=       self.activation(_lowerCamelCase    )
														return hidden_state

class     a		(nn.Module				):




							"""simple docstring"""


							def __init__(							self	:  List[Any]   ,     lowerCamelCase	:  ResNetConfig   ,     lowerCamelCase	:  int   ,     lowerCamelCase	:  int   ,     lowerCamelCase	:  int = 2   ,     lowerCamelCase	:  int = 2   ,     )     ->   str:
														super().__init__()

														__snake_case		:      List[Any]										=       ResNetBottleNeckLayer if config.layer_type == "bottleneck" else ResNetBasicLayer

														__snake_case		:      List[Any]										=       nn.Sequential(
														    # downsampling is done in the first layer with stride of 2
														    layer(_lowerCamelCase   ,     _lowerCamelCase   ,     stride=_lowerCamelCase   ,     activation=config.hidden_act    )   ,     *[layer(_lowerCamelCase   ,     _lowerCamelCase   ,     activation=config.hidden_act    ) for _ in range(depth - 1    )]   ,     )






							def    __snake_case (							self	:  Optional[Any]   ,     lowerCamelCase	:  Tensor    )     ->   Dict:
														__snake_case		:      Optional[int]										=       input
														for layer in self.layers:
																					__snake_case		:      Optional[int]										=       layer(_lowerCamelCase    )
														return hidden_state

class     a		(nn.Module				):




							"""simple docstring"""


							def __init__(							self	:  int   ,     lowerCamelCase	:  ResNetConfig    )     ->   Optional[Any]:
														super().__init__()
														__snake_case		:      Any										=       nn.ModuleList([]    )
														# based on `downsample_in_first_stage` the first layer of the first stage may or may not downsample the input
														self.stages.append(
														    ResNetStage(
														        _lowerCamelCase   ,     config.embedding_size   ,     config.hidden_sizes[0]   ,     stride=2 if config.downsample_in_first_stage else 1   ,     depth=config.depths[0]   ,     )    )
														__snake_case		:      str										=       zip(config.hidden_sizes   ,     config.hidden_sizes[1:]    )
														for (in_channels, out_channels), depth in zip(_lowerCamelCase   ,     config.depths[1:]    ):
																					self.stages.append(ResNetStage(_lowerCamelCase   ,     _lowerCamelCase   ,     _lowerCamelCase   ,     depth=_lowerCamelCase    )    )






							def    __snake_case (							self	:  Union[str, Any]   ,     lowerCamelCase	:  Tensor   ,     lowerCamelCase	:  bool = False   ,     lowerCamelCase	:  bool = True    )     ->   Any:
														__snake_case		:      Optional[Any]										=       () if output_hidden_states else None

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

																					__snake_case		:      Any										=       stage_module(_lowerCamelCase    )

														if output_hidden_states:
																					__snake_case		:      Optional[Any]										=       hidden_states + (hidden_state,)

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

														return BaseModelOutputWithNoAttention(
														    last_hidden_state=_lowerCamelCase   ,     hidden_states=_lowerCamelCase   ,     )

class     a		(A_				):




							"""simple docstring"""


							__UpperCAmelCase   :							Dict					  =  ResNetConfig
							__UpperCAmelCase   :							Optional[Any]					  =  "resnet"
							__UpperCAmelCase   :							str					  =  "pixel_values"
							__UpperCAmelCase   :							Optional[int]					  =  True

							def    __snake_case (							self	:  Optional[Any]   ,     lowerCamelCase	:  int    )     ->   Union[str, Any]:
														if isinstance(_lowerCamelCase   ,     nn.Convad    ):
																					nn.init.kaiming_normal_(module.weight   ,     mode="fan_out"   ,     nonlinearity="relu"    )
														elif isinstance(_lowerCamelCase   ,     (nn.BatchNormad, nn.GroupNorm)    ):
																					nn.init.constant_(module.weight   ,     1    )
																					nn.init.constant_(module.bias   ,     0    )






							def    __snake_case (							self	:  List[str]   ,     lowerCamelCase	:  Optional[Any]   ,     lowerCamelCase	:  Optional[int]=False    )     ->   Tuple:
														if isinstance(_lowerCamelCase   ,     _lowerCamelCase    ):
																					__snake_case		:      List[Any]										=       value
_snake_case					:		Optional[Any]      =    R"\n    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. Use it\n    as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and\n    behavior.\n\n    Parameters:\n        config ([`ResNetConfig`]): Model configuration class with all the parameters of the model.\n            Initializing with a config file does not load the weights associated with the model, only the\n            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.\n"

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

@add_start_docstrings(
    "The bare ResNet model outputting raw features without any specific head on top."					,    A_					,    )
class     a		(A_				):




							"""simple docstring"""


							def __init__(							self	:  Optional[int]   ,     lowerCamelCase	:  Tuple    )     ->   List[str]:
														super().__init__(_lowerCamelCase    )
														__snake_case		:      Optional[int]										=       config
														__snake_case		:      Optional[int]										=       ResNetEmbeddings(_lowerCamelCase    )
														__snake_case		:      List[str]										=       ResNetEncoder(_lowerCamelCase    )
														__snake_case		:      Any										=       nn.AdaptiveAvgPoolad((1, 1)    )
														# Initialize weights and apply final processing
														self.post_init()






							@add_start_docstrings_to_model_forward(_lowerCamelCase    )
							@add_code_sample_docstrings(
							    checkpoint=_CHECKPOINT_FOR_DOC   ,     output_type=_lowerCamelCase   ,     config_class=_CONFIG_FOR_DOC   ,     modality="vision"   ,     expected_output=_EXPECTED_OUTPUT_SHAPE   ,     )
							def    __snake_case (							self	:  Optional[int]   ,     lowerCamelCase	:  Tensor   ,     lowerCamelCase	:  Optional[bool] = None   ,     lowerCamelCase	:  Optional[bool] = None    )     ->   Tuple:
														__snake_case		:      List[str]										=       (
														    output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
														)
														__snake_case		:      str										=       return_dict if return_dict is not None else self.config.use_return_dict

														__snake_case		:      str										=       self.embedder(_lowerCamelCase    )

														__snake_case		:      Union[str, Any]										=       self.encoder(
														    _lowerCamelCase   ,     output_hidden_states=_lowerCamelCase   ,     return_dict=_lowerCamelCase    )

														__snake_case		:      List[str]										=       encoder_outputs[0]

														__snake_case		:      Union[str, Any]										=       self.pooler(_lowerCamelCase    )

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

														return BaseModelOutputWithPoolingAndNoAttention(
														    last_hidden_state=_lowerCamelCase   ,     pooler_output=_lowerCamelCase   ,     hidden_states=encoder_outputs.hidden_states   ,     )

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




							"""simple docstring"""


							def __init__(							self	:  List[str]   ,     lowerCamelCase	:  Optional[int]    )     ->   List[Any]:
														super().__init__(_lowerCamelCase    )
														__snake_case		:      Optional[Any]										=       config.num_labels
														__snake_case		:      Optional[int]										=       ResNetModel(_lowerCamelCase    )
														# classification head
														__snake_case		:      List[Any]										=       nn.Sequential(
														    nn.Flatten()   ,     nn.Linear(config.hidden_sizes[-1]   ,     config.num_labels    ) if config.num_labels > 0 else nn.Identity()   ,     )
														# initialize weights and apply final processing
														self.post_init()






							@add_start_docstrings_to_model_forward(_lowerCamelCase    )
							@add_code_sample_docstrings(
							    checkpoint=_IMAGE_CLASS_CHECKPOINT   ,     output_type=_lowerCamelCase   ,     config_class=_CONFIG_FOR_DOC   ,     expected_output=_IMAGE_CLASS_EXPECTED_OUTPUT   ,     )
							def    __snake_case (							self	:  Optional[int]   ,     lowerCamelCase	:  Optional[torch.FloatTensor] = None   ,     lowerCamelCase	:  Optional[torch.LongTensor] = None   ,     lowerCamelCase	:  Optional[bool] = None   ,     lowerCamelCase	:  Optional[bool] = None   ,     )     ->   Optional[Any]:
														__snake_case		:      Optional[Any]										=       return_dict if return_dict is not None else self.config.use_return_dict

														__snake_case		:      Optional[int]										=       self.resnet(_lowerCamelCase   ,     output_hidden_states=_lowerCamelCase   ,     return_dict=_lowerCamelCase    )

														__snake_case		:      Union[str, Any]										=       outputs.pooler_output if return_dict else outputs[1]

														__snake_case		:      List[str]										=       self.classifier(_lowerCamelCase    )

														__snake_case		:      Union[str, Any]										=       None

														if labels is not None:
																					if self.config.problem_type is None:
																												if self.num_labels == 1:
																																			__snake_case		:      Any										=       "regression"
																												elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
																																			__snake_case		:      int										=       "single_label_classification"
																												else:
																																			__snake_case		:      Optional[Any]										=       "multi_label_classification"
																					if self.config.problem_type == "regression":
																												__snake_case		:      Union[str, Any]										=       MSELoss()
																												if self.num_labels == 1:
																																			__snake_case		:      Union[str, Any]										=       loss_fct(logits.squeeze()   ,     labels.squeeze()    )
																												else:
																																			__snake_case		:      List[Any]										=       loss_fct(_lowerCamelCase   ,     _lowerCamelCase    )
																					elif self.config.problem_type == "single_label_classification":
																												__snake_case		:      Optional[int]										=       CrossEntropyLoss()
																												__snake_case		:      Optional[int]										=       loss_fct(logits.view(-1   ,     self.num_labels    )   ,     labels.view(-1    )    )
																					elif self.config.problem_type == "multi_label_classification":
																												__snake_case		:      List[str]										=       BCEWithLogitsLoss()
																												__snake_case		:      Optional[Any]										=       loss_fct(_lowerCamelCase   ,     _lowerCamelCase    )

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

														return ImageClassifierOutputWithNoAttention(loss=_lowerCamelCase   ,     logits=_lowerCamelCase   ,     hidden_states=outputs.hidden_states    )

@add_start_docstrings(
    "\n    ResNet backbone, to be used with frameworks like DETR and MaskFormer.\n    "					,    A_					,    )
class     a		(A_					,    A_				):




							"""simple docstring"""


							def __init__(							self	:  Optional[int]   ,     lowerCamelCase	:  Union[str, Any]    )     ->   List[str]:
														super().__init__(_lowerCamelCase    )
														super()._init_backbone(_lowerCamelCase    )

														__snake_case		:      int										=       [config.embedding_size] + config.hidden_sizes
														__snake_case		:      str										=       ResNetEmbeddings(_lowerCamelCase    )
														__snake_case		:      Any										=       ResNetEncoder(_lowerCamelCase    )

														# initialize weights and apply final processing
														self.post_init()






							@add_start_docstrings_to_model_forward(_lowerCamelCase    )
							@replace_return_docstrings(output_type=_lowerCamelCase   ,     config_class=_CONFIG_FOR_DOC    )
							def    __snake_case (							self	:  List[str]   ,     lowerCamelCase	:  Tensor   ,     lowerCamelCase	:  Optional[bool] = None   ,     lowerCamelCase	:  Optional[bool] = None    )     ->   Any:
														__snake_case		:      Dict										=       return_dict if return_dict is not None else self.config.use_return_dict
														__snake_case		:      Tuple										=       (
														    output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
														)

														__snake_case		:      int										=       self.embedder(_lowerCamelCase    )

														__snake_case		:      str										=       self.encoder(_lowerCamelCase   ,     output_hidden_states=_lowerCamelCase   ,     return_dict=_lowerCamelCase    )

														__snake_case		:      Any										=       outputs.hidden_states

														__snake_case		:      Tuple										=       ()
														for idx, stage in enumerate(self.stage_names    ):
																					if stage in self.out_features:
																												feature_maps += (hidden_states[idx],)

														if not return_dict:
																					__snake_case		:      Optional[int]										=       (feature_maps,)
																					if output_hidden_states:
																												output += (outputs.hidden_states,)
																					return output

														return BackboneOutput(
														    feature_maps=_lowerCamelCase   ,     hidden_states=outputs.hidden_states if output_hidden_states else None   ,     attentions=_lowerCamelCase   ,     )





from typing import List, Union

from ..utils import (
    add_end_docstrings,
    is_tf_available,
    is_torch_available,
    is_vision_available,
    logging,
    requires_backends,
)
from .base import PIPELINE_INIT_ARGS, Pipeline


if is_vision_available():
			from PIL import Image

			from ..image_utils import load_image

if is_tf_available():
			import tensorflow as tf

			from ..models.auto.modeling_tf_auto import TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING
			from ..tf_utils import stable_softmax

if is_torch_available():
			from ..models.auto.modeling_auto import MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING

_snake_case					:		Optional[int]      =    logging.get_logger(__name__)

@add_end_docstrings(_lowerCAmelCase				)
class     a		(_lowerCAmelCase				):




							"""simple docstring"""


							def __init__(							self	:  Tuple   ,     *lowerCamelCase	:  Any   ,     **lowerCamelCase	:  Tuple    )     ->   int:
														super().__init__(*lowerCamelCase   ,     **lowerCamelCase    )
														requires_backends(self   ,     "vision"    )
														self.check_model_type(
														    TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING
														    if self.framework == "tf"
														    else MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING    )

							def    __snake_case (							self	:  List[str]   ,     lowerCamelCase	:  Optional[Any]=None    )     ->   Optional[int]:
														__snake_case		:      Optional[Any]										=       {}
														if top_k is not None:
																					__snake_case		:      List[Any]										=       top_k
														return {}, {}, postprocess_params

							def __call__(							self	:  List[Any]   ,     lowerCamelCase	:  Union[str, List[str], "Image.Image", List["Image.Image"]]   ,     **lowerCamelCase	:  Dict    )     ->   Optional[int]:
														return super().__call__(lowerCamelCase   ,     **lowerCamelCase    )

							def    __snake_case (							self	:  Optional[Any]   ,     lowerCamelCase	:  List[Any]    )     ->   int:
														__snake_case		:      Any										=       load_image(lowerCamelCase    )
														__snake_case		:      str										=       self.image_processor(images=lowerCamelCase   ,     return_tensors=self.framework    )
														return model_inputs

							def    __snake_case (							self	:  int   ,     lowerCamelCase	:  List[str]    )     ->   Tuple:
														__snake_case		:      List[Any]										=       self.model(**lowerCamelCase    )
														return model_outputs






							def    __snake_case (							self	:  List[Any]   ,     lowerCamelCase	:  Any   ,     lowerCamelCase	:  Optional[Any]=5    )     ->   List[str]:
														if top_k > self.model.config.num_labels:
																					__snake_case		:      int										=       self.model.config.num_labels

														if self.framework == "pt":
																					__snake_case		:      Optional[Any]										=       model_outputs.logits.softmax(-1    )[0]
																					__snake_case			,      __snake_case		:      List[str]										=       probs.topk(lowerCamelCase    )
														elif self.framework == "tf":
																					__snake_case		:      Tuple										=       stable_softmax(model_outputs.logits   ,     axis=-1    )[0]
																					__snake_case		:      Optional[Any]										=       tf.math.top_k(lowerCamelCase   ,     k=lowerCamelCase    )
																					__snake_case			,      __snake_case		:      List[Any]										=       topk.values.numpy(), topk.indices.numpy()
														else:
																					raise ValueError(F'Unsupported framework: {self.framework}'    )

														__snake_case		:      Any										=       scores.tolist()
														__snake_case		:      Optional[int]										=       ids.tolist()
														return [{"score": score, "label": self.model.config.idalabel[_id]} for score, _id in zip(lowerCamelCase   ,     lowerCamelCase    )]

