


'''simple docstring'''
from manim import *




class 			lowerCamelCase_   (	__a      ):






      def lowercase_							(					self				:    Optional[int] ):


          '''simple docstring'''


          UpperCAmelCase__			:		Union[str, Any]													=				Rectangle(height=0.5						,						width=0.5 )
          UpperCAmelCase__			:		Any													=				Rectangle(height=0.4_6						,						width=0.4_6 ).set_stroke(width=0 )

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

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

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

          UpperCAmelCase__			:		Optional[int]													=				Text('''Model'''						,						font_size=24 )
          UpperCAmelCase__			:		Tuple													=				Group(_A						,						_A ).arrange(_A						,						buff=0.5						,						aligned_edge=_A )
          model.move_to([3, -1.0, 0] )
          self.add(_A )

          UpperCAmelCase__			:		int													=				[]
          for i, rect in enumerate(_A ):
              rect.set_stroke(_A )
              # target = fill.copy().set_fill(YELLOW, opacity=0.7)
              # target.move_to(rect)
              # self.add(target)

              UpperCAmelCase__			:		Any													=				Rectangle(height=0.4_6 / 4						,						width=0.4_6 / 3 ).set_stroke(width=0.0 ).set_fill(_A						,						opacity=0.7 )

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

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

          UpperCAmelCase__			:		Union[str, Any]													=				Text('''Loaded Checkpoint'''						,						font_size=24 )
          UpperCAmelCase__			:		List[str]													=				Group(_A						,						_A ).arrange(_A						,						aligned_edge=_A						,						buff=0.4 )
          checkpoint.move_to([3, 0.5, 0] )

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

          UpperCAmelCase__			:		Any													=				MarkupText(
              f"""<b>Key:</b>\n\n<span fgcolor='{YELLOW}'>●</span> Empty Model"""						,						font_size=18						,						)

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

          self.add(_A						,						_A )

          UpperCAmelCase__			:		Union[str, Any]													=				MarkupText(
              f"""<span fgcolor='{BLUE}'>●</span> Checkpoint"""						,						font_size=18						,						)

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

          UpperCAmelCase__			:		Optional[int]													=				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=24						,						)
          step_a.move_to([2, 2, 0] )
          self.play(Write(_A )						,						Write(_A ) )

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

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

              UpperCAmelCase__			:		List[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(_A						,						run_time=1.5 ) )

          self.play(*_A )
          self.play(*_A )
          self.wait()




'''simple docstring'''
def 					a__       (					lowerCAmelCase__						)    ->	int:
    if a < 0:
        raise ValueError('''Input value must be a positive integer'''						)
    elif isinstance(lowerCAmelCase__  ,					lowerCAmelCase__						):
        raise TypeError('''Input value must be a \'int\' type'''						)
    return bin(lowerCAmelCase__						).count('''1'''						)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
