

# We ignore warnings about stepping the scheduler since we step it ourselves during gradient accumulation

import warnings

from .state import AcceleratorState, GradientState


warnings.filterwarnings("""ignore""", category=UserWarning, module="""torch.optim.lr_scheduler""")






class 						__magic_name__					:






     def __init__(				self		,						_lowercase		,						_lowercase		,						_lowercase = True		,						_lowercase = False	)->     Dict:
         UpperCamelCase_			  =						scheduler
         UpperCamelCase_			  =						optimizers if isinstance(_lowercase		,						(list, tuple)	) else [optimizers]
         UpperCamelCase_			  =						split_batches
         UpperCamelCase_			  =						step_with_optimizer
         UpperCamelCase_			  =						GradientState()






     def 	UpperCAmelCase_				(				self		,						*_lowercase		,						**_lowercase	)->     List[str]:
         if not self.step_with_optimizer:
             # No link between scheduler and optimizer -> just step
             self.scheduler.step(*_lowercase		,						**_lowercase	)
             return

         # Otherwise, first make sure the optimizer was stepped.
         if not self.gradient_state.sync_gradients:
             if self.gradient_state.adjust_scheduler:
                 self.scheduler._step_count += 1
             return

         for opt in self.optimizers:
             if opt.step_was_skipped:
                 return
         if self.split_batches:
             # Split batches -> the training dataloader batch size is not changed so one step per training step
             self.scheduler.step(*_lowercase		,						**_lowercase	)
         else:
             # Otherwise the training dataloader batch size was multiplied by `num_processes`, so we need to do
             # num_processes steps per training step
             UpperCamelCase_			  =						AcceleratorState().num_processes
             for _ in range(_lowercase	):
                 # Special case when using OneCycle and `drop_last` was not used
                 if hasattr(self.scheduler		,						"total_steps"	):
                     if self.scheduler._step_count <= self.scheduler.total_steps:
                         self.scheduler.step(*_lowercase		,						**_lowercase	)
                 else:
                     self.scheduler.step(*_lowercase		,						**_lowercase	)






     def 	UpperCAmelCase_				(				self	)->     str:
         return self.scheduler.get_last_lr()






     def 	UpperCAmelCase_				(				self	)->     Dict:
         return self.scheduler.state_dict()






     def 	UpperCAmelCase_				(				self		,						_lowercase	)->     Optional[int]:
         self.scheduler.load_state_dict(_lowercase	)






     def 	UpperCAmelCase_				(				self	)->     Union[str, Any]:
         return self.scheduler.get_lr()






     def 	UpperCAmelCase_				(				self		,						*_lowercase		,						**_lowercase	)->     List[str]:
         return self.scheduler.print_lr(*_lowercase		,						**_lowercase	)



def 			lowerCAmelCase(      SCREAMING_SNAKE_CASE_ = 4_0_0_0_0_0_0			)->						int:



    """simple docstring"""






    UpperCamelCase_			  =						[0, 1]
    UpperCamelCase_			  =						0
    while fib[i] <= n:
        fib.append(fib[i] + fib[i + 1]			)
        if fib[i + 2] > n:
            break
        i += 1
    UpperCamelCase_			  =						0
    for j in range(len(SCREAMING_SNAKE_CASE_			) - 1			):
        if fib[j] % 2 == 0:
            total += fib[j]

    return total


if __name__ == "__main__":
 print(F'''{solution() = }''')
