Skip to content
class

AutocastGuard

AutocastGuard

RAII guard that activates (or disables) AMP for a device (or all active devices) for the duration of the guard's lifetime.

Constructors

1
ctor

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

1
dtor

~AutocastGuard

Restores the previous AMP state captured at construction.

Runs unconditionally — required for correct nesting semantics.

Operators

1
op

operator=

AutocastGuard & operator=(const AutocastGuard &)