diff --git a/docs/api/python/libinfo/libinfo.md b/docs/api/python/libinfo/libinfo.md index 531e1ced3c99..032230c968f6 100644 --- a/docs/api/python/libinfo/libinfo.md +++ b/docs/api/python/libinfo/libinfo.md @@ -52,9 +52,6 @@ In [6]: .. autosummary:: :nosignatures: - Features - Feature - feature_list ``` ## API Reference diff --git a/python/mxnet/runtime.py b/python/mxnet/runtime.py index 7ef5e1943072..d660e77534cd 100644 --- a/python/mxnet/runtime.py +++ b/python/mxnet/runtime.py @@ -27,17 +27,27 @@ class Feature(ctypes.Structure): """ - Compile time feature description + Compile time feature description, member fields: `name` and `enabled`. """ _fields_ = [ ("_name", ctypes.c_char_p), - ("enabled", ctypes.c_bool) + ("_enabled", ctypes.c_bool) ] @property def name(self): + """ + feature name + """ return self._name.decode() + @property + def enabled(self): + """ + True if MXNet was compiled with the given compile-time feature + """ + return self._enabled + def __repr__(self): if self.enabled: return "✔ {}".format(self.name) @@ -50,7 +60,8 @@ def feature_list(): Returns ------- - :return: list of class LibFeature indicating which features are available and enabled + list + List of :class:`.Feature` objects """ lib_features_c_array = ctypes.POINTER(Feature)() lib_features_size = ctypes.c_size_t() @@ -74,11 +85,13 @@ def is_enabled(self, feature_name): Parameters ---------- - :param x: str The name of a valid feature as string for example 'CUDA' + feature_name: str + The name of a valid feature as string for example 'CUDA' Returns ------- - :return: bool True if it's enabled, False if it's disabled, RuntimeError if the feature is not known + Boolean + True if it's enabled, False if it's disabled, RuntimeError if the feature is not known """ feature_name = feature_name.upper() if feature_name not in self: