RAII guard that activates (or disables) AMP for a device (or all active devices) for the duration of the guard's lifetime.
Constructors
1ctor
AutocastGuard
void AutocastGuard(Dtype target)Sets the autocast target dtype to target on whichever device(s) currently have AMP active (or both devices if neither is active).
Destructor
1dtor
~AutocastGuard
void ~AutocastGuard()Restores the previous AMP state captured at construction.
Runs unconditionally — required for correct nesting semantics.