Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Dnn::Compute::ComputePrecision Class Referenceexport

Controls automatic mixed precision behavior for neural network operations. More...

Public Types

enum class  Policy { Disabled , Auto , Performance , Accuracy }
 Basic precision policy preference. More...
 

Public Member Functions

 ComputePrecision (Policy policy=Policy::Auto)
 Construct a ComputePrecision with the specified policy.
 
Policy getPolicy () const
 Get the current policy.
 
bool isEnabled () const
 Check if automatic mixed precision is enabled.
 
void setPolicy (Policy policy)
 Set the policy preference.
 
std::string toString () const
 Convert the precision policy to a string representation.
 

Private Attributes

Policy policy_
 

Detailed Description

Controls automatic mixed precision behavior for neural network operations.

This lightweight class enables or disables automatic mixed precision (AMP) and provides a basic policy preference, but leaves the actual precision decisions to the underlying libraries and kernels which have sophisticated internal heuristics.

Member Enumeration Documentation

◆ Policy

Basic precision policy preference.

Enumerator
Disabled 
Auto 
Performance 
Accuracy 

Constructor & Destructor Documentation

◆ ComputePrecision()

Mila::Dnn::Compute::ComputePrecision::ComputePrecision ( Policy  policy = Policy::Auto)
inline

Construct a ComputePrecision with the specified policy.

Member Function Documentation

◆ getPolicy()

Policy Mila::Dnn::Compute::ComputePrecision::getPolicy ( ) const
inline

Get the current policy.

◆ isEnabled()

bool Mila::Dnn::Compute::ComputePrecision::isEnabled ( ) const
inline

Check if automatic mixed precision is enabled.

◆ setPolicy()

void Mila::Dnn::Compute::ComputePrecision::setPolicy ( Policy  policy)
inline

Set the policy preference.

Here is the caller graph for this function:

◆ toString()

std::string Mila::Dnn::Compute::ComputePrecision::toString ( ) const
inline

Convert the precision policy to a string representation.

Returns
std::string String representation of the precision policy.

Member Data Documentation

◆ policy_

Policy Mila::Dnn::Compute::ComputePrecision::policy_
private

The documentation for this class was generated from the following file: