



"""simple docstring"""
import random
import unittest

import torch

from diffusers import IFSuperResolutionPipeline
from diffusers.utils import floats_tensor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import skip_mps, torch_device

from ..pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS
from ..test_pipelines_common import PipelineTesterMixin
from . import IFPipelineTesterMixin
@skip_mps
class 							lowerCamelCase    (     _lowerCAmelCase       ,		_lowerCAmelCase       ,		unittest.TestCase							):






					'''simple docstring'''





					_A						:     Dict		=	IFSuperResolutionPipeline
					_A						:     Optional[Any]		=	TEXT_GUIDED_IMAGE_VARIATION_PARAMS - {"""width""", """height"""}
					_A						:     str		=	TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS
					_A						:     Tuple		=	PipelineTesterMixin.required_optional_params - {"""latents"""}






					def   lowerCAmelCase_							(			self:				Tuple		)  ->      Any:
											return self._get_superresolution_dummy_components()






					def   lowerCAmelCase_							(			self:				Dict		,	snake_case:				Tuple		,	snake_case:				str=0		)  ->      Any:
											if str(snake_case		).startswith("""mps"""		):
																	snake_case_					:int		=     torch.manual_seed(snake_case		)
											else:
																	snake_case_					:str		=     torch.Generator(device=snake_case		).manual_seed(snake_case		)

											snake_case_					:List[Any]		=     floats_tensor((1, 3, 32, 32)		,	rng=random.Random(snake_case		)		).to(snake_case		)

											snake_case_					:Optional[int]		=     {
											    """prompt""": """A painting of a squirrel eating a burger""",
											    """image""": image,
											    """generator""": generator,
											    """num_inference_steps""": 2,
											    """output_type""": """numpy""",
											}

											return inputs






					@unittest.skipIf(
					    torch_device != """cuda""" or not is_xformers_available()		,	reason="""XFormers attention is only available with CUDA and `xformers` installed"""		,	)
					def   lowerCAmelCase_							(			self:				Optional[Any]		)  ->      int:
											self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=1E-3		)






					def   lowerCAmelCase_							(			self:				Union[str, Any]		)  ->      Optional[Any]:
											self._test_save_load_optional_components()






					@unittest.skipIf(torch_device != """cuda"""		,	reason="""float16 requires CUDA"""		)
					def   lowerCAmelCase_							(			self:				List[str]		)  ->      str:
											# Due to non-determinism in save load of the hf-internal-testing/tiny-random-t5 text encoder
											super().test_save_load_floataa(expected_max_diff=1E-1		)






					def   lowerCAmelCase_							(			self:				Any		)  ->      Optional[int]:
											self._test_attention_slicing_forward_pass(expected_max_diff=1E-2		)






					def   lowerCAmelCase_							(			self:				Union[str, Any]		)  ->      List[str]:
											self._test_save_load_local()






					def   lowerCAmelCase_							(			self:				Union[str, Any]		)  ->      List[Any]:
											self._test_inference_batch_single_identical(
											    expected_max_diff=1E-2		,	)





"""simple docstring"""
import os
def   A_    (     ):







						'''simple docstring'''


						snake_case_					:Optional[Any]		=     os.path.dirname(os.path.realpath(_lowercase      )      )
						snake_case_					:int		=     os.path.join(_lowercase,   """triangle.txt"""      )

						with open(_lowercase      ) as in_file:
												snake_case_					:List[Any]		=     [[int(_lowercase      ) for i in line.split()] for line in in_file]

						while len(_lowercase      ) != 1:
												snake_case_					:str		=     triangle.pop()
												snake_case_					:int		=     triangle[-1]
												for j in range(len(_lowercase      ) - 1      ):
																		curr_row[j] += max(last_row[j],   last_row[j + 1]      )
						return triangle[0][0]


if __name__ == "__main__":
						print(solution())
