Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
minor: Refine documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
larroy authored and Pedro Larroy committed Feb 25, 2019
1 parent 5f32f32 commit c31b7d8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
3 changes: 0 additions & 3 deletions docs/api/python/libinfo/libinfo.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ In [6]:
.. autosummary::
:nosignatures:
Features
Feature
feature_list
```

## API Reference
Expand Down
23 changes: 18 additions & 5 deletions python/mxnet/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand All @@ -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:
Expand Down

0 comments on commit c31b7d8

Please sign in to comment.