

from manim import *






class 							A_ (		a_					):


     def   UpperCAmelCase  (							self			:		Union[str, Any]					)							->	Any:
      __lowerCAmelCase:   Optional[Any]   	=      Rectangle(height=0.5			,  width=0.5					)
      __lowerCAmelCase:   Optional[int]   	=      Rectangle(height=0.46			,  width=0.46					).set_stroke(width=0					)

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

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

      __lowerCAmelCase:   Optional[Any]   	=      [mem.copy() for i in range(6					)]
      __lowerCAmelCase:   Union[str, Any]   	=      VGroup(*_lowerCamelCase					).arrange(_lowerCamelCase			,  buff=0					)

      __lowerCAmelCase:   Optional[int]   	=      Text('Model'			,  font_size=2_4					)
      __lowerCAmelCase:   Union[str, Any]   	=      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:   int   	=      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:   Optional[Any]   	=      [mem.copy() for i in range(6					)]
      __lowerCAmelCase:   List[Any]   	=      VGroup(*_lowerCamelCase					).arrange(_lowerCamelCase			,  buff=0					)

      __lowerCAmelCase:   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:   Optional[Any]   	=      Square(side_length=2.2					)
      key.move_to([-5, 2, 0]					)

      __lowerCAmelCase:   Tuple   	=      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:   str   	=      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:   List[str]   	=      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:   Optional[int]   	=      []
      __lowerCAmelCase:   List[str]   	=      []
      for i, rect in enumerate(_lowerCamelCase					):
       __lowerCAmelCase:   int   	=      fill.copy().set_fill(_lowerCamelCase			,  opacity=0.7					)
       target.move_to(_lowerCamelCase					)
       first_animations.append(GrowFromCenter(_lowerCamelCase			,  run_time=1					)					)

       __lowerCAmelCase:   Union[str, Any]   	=      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"""



from __future__ import annotations

from collections.abc import Iterator
from typing import Generic, TypeVar

_UpperCamelCase		:  Any						=		TypeVar('T')

class        a     (   Generic[T]	):







    def __init__(			self							,		_lowerCamelCase       ):
      lowercase							    =       data
      lowercase							    =       None







    def __str__(			self       ):
      return F'{self.data}'


class        a     (   Generic[T]	):







    def __init__(			self       ):
      lowercase							    =       None







    def __iter__(			self       ):
      lowercase							    =       self.top
      while node:
        yield node.data
        lowercase							    =       node.next







    def __str__(			self       ):
      return "->".join([str(_lowerCamelCase       ) for item in self]       )







    def __len__(			self       ):
      return len(tuple(iter(self       )       )       )







    def 			UpperCamelCase_      (			self       ):
      return self.top is None







    def 			UpperCamelCase_      (			self							,		_lowerCamelCase       ):
      lowercase							    =       Node(_lowerCamelCase       )
      if not self.is_empty():
        lowercase							    =       self.top
      lowercase							    =       node







    def 			UpperCamelCase_      (			self       ):
      if self.is_empty():
        raise IndexError('pop from empty stack'       )
      assert isinstance(self.top							,		_lowerCamelCase       )
      lowercase							    =       self.top
      lowercase							    =       self.top.next
      return pop_node.data







    def 			UpperCamelCase_      (			self       ):
      if self.is_empty():
        raise IndexError('peek from empty stack'       )

      assert self.top is not None
      return self.top.data







    def 			UpperCamelCase_      (			self       ):
      lowercase							    =       None


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

    testmod()


