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

功能门 (Python)

稳定版 API

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

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:ENUM 名称必须与 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 开发者文档

查看文档

教程

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

查看教程

资源

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

查看资源