• 文件 >
  • 特性開關 (Python)
快捷方式

特性開關 (Python)

穩定 API

class fbgemm_gpu.config.FeatureGateName(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

FBGEMM_GPU 特性開關列舉 (Python)。

程式碼示例

from fbgemm_gpu.config import FeatureGateName

def foo():
    if FeatureGateName.TBE_V2.is_enabled():

        # Do something if feature is enabled
        ...
    else:
        # Do something different if feature is disabled
        ...

注意

雖然不是必需的,但最好在 C++ 中(位於 fbgemm_gpu/config/feature_gates.h)映象這些列舉值。

對於 fbcode:列舉名稱必須與 UI 中的 JK knob 名稱完全匹配。對於開源版本 (OSS):環境變數將被解析為 f”FBGEMM_{ENUM}”

class fbgemm_gpu.config.FeatureGate[source]

FBGEMM_GPU 特性開關。

存在此類的原因是在將列舉打包到模型中時,無法呼叫列舉上定義的方法(其機制尚不明確)。

程式碼示例

from deeplearning.fbgemm.fbgemm_gpu.config import FeatureGate, FeatureGateName

FeatureGate.is_enabled(FeatureGateName.TBE_V2)

文件

查閱 PyTorch 全面的開發者文件

檢視文件

教程

獲取針對初學者和高階開發者的深入教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源