


from typing import Dict, Optional, Tuple

import torch



def      __lowerCAmelCase    (				snake_case						:     torch.Tensor			)							->				torch.Tensor:
   __lowerCamelCase:					Union[str, Any]	 =						boundaries[1] - boundaries[0]
   __lowerCamelCase:					int	 =						boundaries + step / 2
   __lowerCamelCase:					Optional[int]	 =						torch.cat([bin_centers, (bin_centers[-1] + step).unsqueeze(-1			)]    ,   dim=0			)
   return bin_centers



def      __lowerCAmelCase    (				snake_case						:     torch.Tensor    ,   snake_case						:     torch.Tensor    ,   )							->				Tuple[torch.Tensor, torch.Tensor]:
   __lowerCamelCase:					List[Any]	 =						_calculate_bin_centers(a_			)
   return (
       torch.sum(aligned_distance_error_probs * bin_centers    ,   dim=-1			),
       bin_centers[-1],
   )



def      __lowerCAmelCase    (				snake_case						:     torch.Tensor    ,   snake_case						:     int = 31    ,   snake_case						:     int = 64    ,   **snake_case						:     Union[str, Any]    ,   )							->				Dict[str, torch.Tensor]:
   __lowerCamelCase:					int	 =						torch.linspace(0    ,   a_    ,   steps=(no_bins - 1)    ,   device=logits.device			)

   __lowerCamelCase:					str	 =						torch.nn.functional.softmax(a_    ,   dim=-1			)
   __lowerCamelCase ,  __lowerCamelCase:					Any	 =						_calculate_expected_aligned_error(
       alignment_confidence_breaks=a_    ,   aligned_distance_error_probs=a_    ,   )

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







def      __lowerCAmelCase    (				snake_case						:     torch.Tensor    ,   snake_case						:     Optional[torch.Tensor] = None    ,   snake_case						:     int = 31    ,   snake_case						:     int = 64    ,   snake_case						:     float = 1e-8    ,   **snake_case						:     Tuple    ,   )							->				torch.Tensor:







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

   __lowerCamelCase:					List[Any]	 =						torch.linspace(0    ,   a_    ,   steps=(no_bins - 1)    ,   device=logits.device			)

   __lowerCamelCase:					str	 =						_calculate_bin_centers(a_			)
   torch.sum(a_			)
   __lowerCamelCase:					Dict	 =						logits.shape[-2]
   __lowerCamelCase:					Tuple	 =						max(a_    ,   19			)

   __lowerCamelCase:					Dict	 =						1.24 * (clipped_n - 15) ** (1.0 / 3) - 1.8

   __lowerCamelCase:					Tuple	 =						torch.nn.functional.softmax(a_    ,   dim=-1			)

   __lowerCamelCase:					Optional[Any]	 =						1.0 / (1 + (bin_centers**2) / (da**2))
   __lowerCamelCase:					List[Any]	 =						torch.sum(probs * tm_per_bin    ,   dim=-1			)

   __lowerCamelCase:					List[str]	 =						residue_weights / (eps + residue_weights.sum())
   __lowerCamelCase:					List[Any]	 =						torch.sum(predicted_tm_term * normed_residue_mask    ,   dim=-1			)

   __lowerCamelCase:					Dict	 =						per_alignment * residue_weights

   __lowerCamelCase:					Tuple	 =						(weighted == torch.max(a_			)).nonzero()[0]
   return per_alignment[tuple(a_			)]





def        _lowercase  (					a_					:       str       ,a_					:       List[str]					)					->						Optional[Any]:




					'''simple docstring'''







					sequence.append(a_					)

					__magic_name__				=     0
					while sequence[index] != target:
										index += 1

					sequence.pop()

					if index == len(a_					):
										return None

					return index


if __name__ == "__main__":
						A__							=				input("Enter numbers separated by comma:\n").strip()
						A__							=				[int(item) for item in user_input.split(",")]

						A__							=				input("Enter a single number to be found in the list:\n")
						A__							=				int(target_input)
						A__							=				sentinel_linear_search(sequence, target)
						if result is not None:
												print(f'''{target} found at positions: {result}''')
						else:
												print("Not found")




