特性开关 (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}”