


'''simple docstring'''
from typing import Dict, Optional, Tuple

import torch




def      __snake_case       (       lowerCamelCase_ :				torch.Tensor						):
				'''simple docstring'''




				__magic_name__	  = boundaries[1] - boundaries[0]
				__magic_name__	  = boundaries + step / 2
				__magic_name__	  = torch.cat([bin_centers, (bin_centers[-1] + step).unsqueeze(-1						)]	,  dim=0						)
				return bin_centers




def      __snake_case       (       lowerCamelCase_ :				torch.Tensor	,  lowerCamelCase_ :				torch.Tensor	,  ):
				'''simple docstring'''




				__magic_name__	  = _calculate_bin_centers(lowerCamelCase_						)
				return (
				    torch.sum(aligned_distance_error_probs * bin_centers	,  dim=-1						),
				    bin_centers[-1],
				)




def      __snake_case       (       lowerCamelCase_ :				torch.Tensor	,  lowerCamelCase_ :				int = 31	,  lowerCamelCase_ :				int = 64	,  **lowerCamelCase_ :				Union[str, Any]	,  ):
				'''simple docstring'''




				__magic_name__	  = torch.linspace(0	,  lowerCamelCase_	,  steps=(no_bins - 1)	,  device=logits.device						)

				__magic_name__	  = torch.nn.functional.softmax(lowerCamelCase_	,  dim=-1						)
				__magic_name__  ,      __magic_name__	  = _calculate_expected_aligned_error(
				    alignment_confidence_breaks=lowerCamelCase_	,  aligned_distance_error_probs=lowerCamelCase_	,  )

				return {
				    "aligned_confidence_probs": aligned_confidence_probs,
				    "predicted_aligned_error": predicted_aligned_error,
				    "max_predicted_aligned_error": max_predicted_aligned_error,
				}




def      __snake_case       (       lowerCamelCase_ :				torch.Tensor	,  lowerCamelCase_ :				Optional[torch.Tensor] = None	,  lowerCamelCase_ :				int = 31	,  lowerCamelCase_ :				int = 64	,  lowerCamelCase_ :				float = 1e-8	,  **lowerCamelCase_ :				Dict	,  ):
				'''simple docstring'''




				if residue_weights is None:
								__magic_name__	  = logits.new_ones(logits.shape[-2]						)

				__magic_name__	  = torch.linspace(0	,  lowerCamelCase_	,  steps=(no_bins - 1)	,  device=logits.device						)

				__magic_name__	  = _calculate_bin_centers(lowerCamelCase_						)
				torch.sum(lowerCamelCase_						)
				__magic_name__	  = logits.shape[-2]
				__magic_name__	  = max(lowerCamelCase_	,  19						)

				__magic_name__	  = 1.24 * (clipped_n - 15) ** (1.0 / 3) - 1.8

				__magic_name__	  = torch.nn.functional.softmax(lowerCamelCase_	,  dim=-1						)

				__magic_name__	  = 1.0 / (1 + (bin_centers**2) / (da**2))
				__magic_name__	  = torch.sum(probs * tm_per_bin	,  dim=-1						)

				__magic_name__	  = residue_weights / (eps + residue_weights.sum())
				__magic_name__	  = torch.sum(predicted_tm_term * normed_residue_mask	,  dim=-1						)

				__magic_name__	  = per_alignment * residue_weights

				__magic_name__	  = (weighted == torch.max(lowerCamelCase_						)).nonzero()[0]
				return per_alignment[tuple(lowerCamelCase_						)]







'''simple docstring'''
import warnings

from ...utils import logging
from .image_processing_convnext import ConvNextImageProcessor


__magic_name__   :   int  							=logging.get_logger(__name__)






class 		UpperCamelCase_		(					A   ):





						"""simple docstring"""




						def __init__( self				:					List[str]	,				*_lowerCamelCase				:					List[str]	,				**_lowerCamelCase				:					Optional[Any]  )							->					None:
										warnings.warn(
										    "The class ConvNextFeatureExtractor is deprecated and will be removed in version 5 of Transformers."
										    " Please use ConvNextImageProcessor instead."	,				_lowerCamelCase	,				)
										super().__init__(*_lowerCamelCase	,				**_lowerCamelCase  )



