


"""simple docstring"""





from manim import *



class 		snake_case_(       _A			):






     def      lowerCamelCase__     (	self  :					Dict				):
           lowerCAmelCase					:	Dict       =   Rectangle(height=0.5					,				width=0.5				)
           lowerCAmelCase					:	Any       =   Rectangle(height=0.46					,				width=0.46				).set_stroke(width=0				)

           lowerCAmelCase					:	Tuple       =   [mem.copy() for i in range(6				)]
           lowerCAmelCase					:	List[Any]       =   [mem.copy() for i in range(6				)]
           lowerCAmelCase					:	Optional[int]       =   VGroup(*__lowerCamelCase				).arrange(__lowerCamelCase					,				buff=0				)
           lowerCAmelCase					:	Optional[int]       =   VGroup(*__lowerCamelCase				).arrange(__lowerCamelCase					,				buff=0				)
           lowerCAmelCase					:	int       =   VGroup(__lowerCamelCase					,				__lowerCamelCase				).arrange(__lowerCamelCase					,				buff=0				)
           lowerCAmelCase					:	Tuple       =   Text('''CPU'''					,				font_size=2_4				)
           lowerCAmelCase					:	Tuple       =   Group(__lowerCamelCase					,				__lowerCamelCase				).arrange(__lowerCamelCase					,				buff=0.5					,				aligned_edge=__lowerCamelCase				)
           cpu.move_to([-2.5, -0.5, 0]				)
           self.add(__lowerCamelCase				)

           lowerCAmelCase					:	Any       =   [mem.copy() for i in range(4				)]
           lowerCAmelCase					:	List[Any]       =   VGroup(*__lowerCamelCase				).arrange(__lowerCamelCase					,				buff=0				)
           lowerCAmelCase					:	List[str]       =   Text('''GPU'''					,				font_size=2_4				)
           lowerCAmelCase					:	List[Any]       =   Group(__lowerCamelCase					,				__lowerCamelCase				).arrange(__lowerCamelCase					,				buff=0.5					,				aligned_edge=__lowerCamelCase				)
           gpu.move_to([-1, -1, 0]				)
           self.add(__lowerCamelCase				)

           lowerCAmelCase					:	int       =   [mem.copy() for i in range(6				)]
           lowerCAmelCase					:	Optional[Any]       =   VGroup(*__lowerCamelCase				).arrange(__lowerCamelCase					,				buff=0				)

           lowerCAmelCase					:	Optional[Any]       =   Text('''Model'''					,				font_size=2_4				)
           lowerCAmelCase					:	int       =   Group(__lowerCamelCase					,				__lowerCamelCase				).arrange(__lowerCamelCase					,				buff=0.5					,				aligned_edge=__lowerCamelCase				)
           model.move_to([3, -1.0, 0]				)
           self.add(__lowerCamelCase				)

           lowerCAmelCase					:	List[str]       =   []
           for i, rect in enumerate(__lowerCamelCase				):
                 rect.set_stroke(__lowerCamelCase				)
                 # target = fill.copy().set_fill(YELLOW, opacity=0.7)
                 # target.move_to(rect)
                 # self.add(target)

                 lowerCAmelCase					:	Optional[Any]       =   Rectangle(height=0.46 / 4					,				width=0.46 / 3				).set_stroke(width=0.0				).set_fill(__lowerCamelCase					,				opacity=0.7				)

                 if i == 0:
                       cpu_target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT				)					,				buff=0.02					,				direction=__lowerCamelCase				)
                       cpu_target.set_x(cpu_target.get_x() + 0.1				)
                 elif i == 3:
                       cpu_target.next_to(cpu_targs[0]					,				direction=__lowerCamelCase					,				buff=0.0				)
                 else:
                       cpu_target.next_to(cpu_targs[i - 1]					,				direction=__lowerCamelCase					,				buff=0.0				)
                 self.add(__lowerCamelCase				)
                 cpu_targs.append(__lowerCamelCase				)

           lowerCAmelCase					:	Any       =   [mem.copy() for i in range(6				)]
           lowerCAmelCase					:	str       =   VGroup(*__lowerCamelCase				).arrange(__lowerCamelCase					,				buff=0				)

           lowerCAmelCase					:	List[Any]       =   Text('''Loaded Checkpoint'''					,				font_size=2_4				)
           lowerCAmelCase					:	List[str]       =   Group(__lowerCamelCase					,				__lowerCamelCase				).arrange(__lowerCamelCase					,				aligned_edge=__lowerCamelCase					,				buff=0.4				)
           checkpoint.move_to([3, 0.5, 0]				)

           lowerCAmelCase					:	int       =   Square(side_length=2.2				)
           key.move_to([-5, 2, 0]				)

           lowerCAmelCase					:	Union[str, Any]       =   MarkupText(
               F'''<b>Key:</b>\n\n<span fgcolor=\'{YELLOW}\'>●</span> Empty Model'''					,				font_size=1_8					,				)

           key_text.move_to([-5, 2.4, 0]				)

           self.add(__lowerCamelCase					,				__lowerCamelCase				)

           lowerCAmelCase					:	List[Any]       =   MarkupText(
               F'''<span fgcolor=\'{BLUE}\'>●</span> Checkpoint'''					,				font_size=1_8					,				)

           blue_text.next_to(__lowerCamelCase					,				DOWN * 2.4					,				aligned_edge=key_text.get_left()				)

           lowerCAmelCase					:	Dict       =   MarkupText(
               F'''Next, a <i><span fgcolor=\"{BLUE}\">second</span></i> model is loaded into memory,\nwith the weights of a <span fgcolor=\"{BLUE}\">single shard</span>.'''					,				font_size=2_4					,				)
           step_a.move_to([2, 2, 0]				)
           self.play(Write(__lowerCamelCase				)					,				Write(__lowerCamelCase				)				)

           self.play(Write(__lowerCamelCase					,				run_time=1				)					,				Create(__lowerCamelCase					,				run_time=1				)				)

           lowerCAmelCase					:	int       =   []
           lowerCAmelCase					:	str       =   []
           for i, rect in enumerate(__lowerCamelCase				):
                 lowerCAmelCase					:	List[Any]       =   fill.copy().set_fill(__lowerCamelCase					,				opacity=0.7				)
                 target.move_to(__lowerCamelCase				)
                 first_animations.append(GrowFromCenter(__lowerCamelCase					,				run_time=1				)				)

                 lowerCAmelCase					:	Optional[int]       =   target.copy()
                 cpu_target.generate_target()
                 if i < 5:
                       cpu_target.target.move_to(cpu_left_col_base[i + 1]				)
                 else:
                       cpu_target.target.move_to(cpu_right_col_base[i - 5]				)
                 second_animations.append(MoveToTarget(__lowerCamelCase					,				run_time=1.5				)				)

           self.play(*__lowerCamelCase				)
           self.play(*__lowerCamelCase				)
           self.wait()






"""simple docstring"""





def      _snake_case						(						_snake_case				:			float ,   _snake_case				:			list[float]			):
      if discount_rate < 0:
            raise ValueError('''Discount rate cannot be negative'''			)
      if not cash_flows:
            raise ValueError('''Cash flows list cannot be empty'''			)
      lowerCAmelCase					:	List[str]       =   sum(
          cash_flow / ((1 + discount_rate) ** i) for i, cash_flow in enumerate(_snake_case			)			)
      return round(_snake_case ,   ndigits=2			)


if __name__ == "__main__":
 import doctest

 doctest.testmod()


