• 文档 >
  • 功能门控 (Python)
快捷方式

特性门 (Python)

稳定版 API

class fbgemm_gpu.config.FeatureGateName(*values)[源代码]

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 旋钮名称完全匹配。对于 OSS:环境变量将被评估为 f”FBGEMM_{ENUM}”

class fbgemm_gpu.config.FeatureGate[源代码]

FBGEMM_GPU 特性门。

此类的存在是因为当枚举打包到模型中时(机制尚不清楚),无法调用在枚举上定义的方法。

代码示例

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

FeatureGate.is_enabled(FeatureGateName.TBE_V2)

文档

访问全面的 PyTorch 开发者文档

查看文档

教程

为初学者和高级开发者提供深入的教程

查看教程

资源

查找开发资源并让您的问题得到解答

查看资源