• Docs >
  • Feature Gates (Python)
Shortcuts

Feature Gates (Python)

Stable API

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

FBGEMM_GPU feature gates enum (Python).

Code Example:

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
        ...

Note

While not required, it is best to mirror the enum values in C++, in fbgemm_gpu/config/feature_gates.h.

For fbcode: The ENUM name must match EXACTLY with the JK knob name in the UI For OSS: The environment variable will be evaluated as f”FBGEMM_{ENUM}”

class fbgemm_gpu.config.FeatureGate[source]

FBGEMM_GPU feature gate.

This class exists because methods defined on enums cannot be invoked when the enum is packaged into a model (the mechanism is unclear).

Code Example:

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

FeatureGate.is_enabled(FeatureGateName.TBE_V2)

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources