

"""simple docstring"""





from manim import *




class 					_lowerCAmelCase  (	lowercase   ):







 """simple docstring"""







 def 					_lowercase (			self							:			Any	):
    __lowercase								=						Rectangle(height=0.5,					width=0.5	)
    __lowercase								=						Rectangle(height=0.25,					width=0.25	)
    __lowercase								=						Rectangle(height=0.46,					width=0.46	).set_stroke(width=0	)

    __lowercase								=						[mem.copy() for i in range(6	)]
    __lowercase								=						[mem.copy() for i in range(6	)]
    __lowercase								=						VGroup(*UpperCAmelCase__	).arrange(UpperCAmelCase__,					buff=0	)
    __lowercase								=						VGroup(*UpperCAmelCase__	).arrange(UpperCAmelCase__,					buff=0	)
    __lowercase								=						VGroup(UpperCAmelCase__,					UpperCAmelCase__	).arrange(UpperCAmelCase__,					buff=0	)
    __lowercase								=						Text("CPU",					font_size=2_4	)
    __lowercase								=						Group(UpperCAmelCase__,					UpperCAmelCase__	).arrange(UpperCAmelCase__,					buff=0.5,					aligned_edge=UpperCAmelCase__	)
    cpu.move_to([-2.5, -0.5, 0]	)
    self.add(UpperCAmelCase__	)

    __lowercase								=						[mem.copy() for i in range(4	)]
    __lowercase								=						VGroup(*UpperCAmelCase__	).arrange(UpperCAmelCase__,					buff=0	)
    __lowercase								=						Text("GPU",					font_size=2_4	)
    __lowercase								=						Group(UpperCAmelCase__,					UpperCAmelCase__	).arrange(UpperCAmelCase__,					buff=0.5,					aligned_edge=UpperCAmelCase__	)
    gpu.move_to([-1, -1, 0]	)
    self.add(UpperCAmelCase__	)

    __lowercase								=						[mem.copy() for i in range(6	)]
    __lowercase								=						VGroup(*UpperCAmelCase__	).arrange(UpperCAmelCase__,					buff=0	)

    __lowercase								=						Text("Model",					font_size=2_4	)
    __lowercase								=						Group(UpperCAmelCase__,					UpperCAmelCase__	).arrange(UpperCAmelCase__,					buff=0.5,					aligned_edge=UpperCAmelCase__	)
    model.move_to([3, -1.0, 0]	)
    self.add(UpperCAmelCase__	)

    __lowercase								=						[]
    __lowercase								=						[]
    __lowercase								=						[]

    for i, rect in enumerate(UpperCAmelCase__	):
       rect.set_stroke(UpperCAmelCase__	)

       __lowercase								=						Rectangle(height=0.46 / 4,					width=0.46 / 3	).set_stroke(width=0.0	).set_fill(UpperCAmelCase__,					opacity=0.7	)

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

    self.add(*UpperCAmelCase__,					*UpperCAmelCase__,					*UpperCAmelCase__	)

    __lowercase								=						[mem.copy() for i in range(6	)]
    __lowercase								=						VGroup(*UpperCAmelCase__	).arrange(UpperCAmelCase__,					buff=0	)

    __lowercase								=						Text("Loaded Checkpoint",					font_size=2_4	)
    __lowercase								=						Group(UpperCAmelCase__,					UpperCAmelCase__	).arrange(UpperCAmelCase__,					buff=0.5,					aligned_edge=UpperCAmelCase__	)
    checkpoint.move_to([3, 0.5, 0]	)

    self.add(UpperCAmelCase__	)

    __lowercase								=						[]
    __lowercase								=						[]

    for i, rect in enumerate(UpperCAmelCase__	):
       __lowercase								=						fill.copy().set_fill(UpperCAmelCase__,					opacity=0.7	)
       target.move_to(UpperCAmelCase__	)
       ckpt_arr.append(UpperCAmelCase__	)

       __lowercase								=						target.copy()
       if i < 5:
          cpu_target.move_to(cpu_left_col_base[i + 1]	)
       else:
          cpu_target.move_to(cpu_right_col_base[i - 5]	)
       ckpt_cpu_arr.append(UpperCAmelCase__	)
    self.add(*UpperCAmelCase__,					*UpperCAmelCase__	)

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

    __lowercase								=						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(UpperCAmelCase__,					UpperCAmelCase__	)

    __lowercase								=						MarkupText(
        F"""<span fgcolor='{BLUE}'>●</span> Checkpoint""",					font_size=1_8,					)

    blue_text.next_to(UpperCAmelCase__,					DOWN * 2.4,					aligned_edge=key_text.get_left()	)
    self.add(UpperCAmelCase__	)

    __lowercase								=						MarkupText(
        F"""Based on the passed in configuration, weights are stored in\na variety of np.memmaps on disk or to a particular device.""",					font_size=2_4,					)
    step_a.move_to([2, 2, 0]	)

    __lowercase								=						[meta_mem.copy() for i in range(6	)]
    __lowercase								=						[meta_mem.copy() for i in range(6	)]
    __lowercase								=						VGroup(*UpperCAmelCase__	).arrange(UpperCAmelCase__,					buff=0	)
    __lowercase								=						VGroup(*UpperCAmelCase__	).arrange(UpperCAmelCase__,					buff=0	)
    __lowercase								=						VGroup(UpperCAmelCase__,					UpperCAmelCase__	).arrange(UpperCAmelCase__,					buff=0	)
    __lowercase								=						Text("Disk",					font_size=2_4	)
    __lowercase								=						Group(UpperCAmelCase__,					UpperCAmelCase__	).arrange(UpperCAmelCase__,					buff=0.5,					aligned_edge=UpperCAmelCase__	)
    disk.move_to([-4.0, -1.25, 0]	)
    self.play(Write(UpperCAmelCase__,					run_time=3	),					Write(UpperCAmelCase__,					run_time=1	),					Create(UpperCAmelCase__,					run_time=1	)	)

    __lowercase								=						[]
    for i, rect in enumerate(UpperCAmelCase__	):
       __lowercase								=						rect.copy()
       target.generate_target()
       target.target.move_to(disk_left_col_base[i]	).scale(0.5	)
       animations.append(MoveToTarget(UpperCAmelCase__,					run_time=1.5	)	)
    self.play(*UpperCAmelCase__	)

    self.play(FadeOut(UpperCAmelCase__	)	)

    __lowercase								=						MarkupText(F"""Then, the checkpoint is removed from memory\nthrough garbage collection.""",					font_size=2_4	)
    step_a.move_to([2, 2, 0]	)

    self.play(Write(UpperCAmelCase__,					run_time=3	)	)

    self.play(
        FadeOut(UpperCAmelCase__,					UpperCAmelCase__,					*UpperCAmelCase__,					*UpperCAmelCase__	),					)

    self.wait()







def 						UpperCamelCase					(lowercase_: int = 10					)     ->      str:
	if not isinstance(lowercase_    ,      lowercase_					) or n < 0:
		raise ValueError("""Invalid input"""					)
	A__							:    List[str]        =		10**n
	A__							:    Any        =		28433 * (pow(2    ,      7830457    ,      lowercase_					)) + 1
	return str(number % modulus					)


if __name__ == "__main__":
	from doctest import testmod

	testmod()
	print(f'''{solution(10) = }''')



