From 1b5877f28d839c63b58ceb7d6f9587c9d84f9d0b Mon Sep 17 00:00:00 2001 From: Liangfu Chen <chenclf@gmail.com> Date: Fri, 27 Apr 2018 23:54:57 +0800 Subject: [PATCH] [DOCS] improve document of symbol; (#456) --- nnvm/docs/api/python/symbol.rst | 3 +++ nnvm/python/nnvm/symbol.py | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/nnvm/docs/api/python/symbol.rst b/nnvm/docs/api/python/symbol.rst index c3b20d085..c341d2ef7 100644 --- a/nnvm/docs/api/python/symbol.rst +++ b/nnvm/docs/api/python/symbol.rst @@ -3,5 +3,8 @@ nnvm.symbol .. automodule:: nnvm.symbol .. autoclass:: nnvm.symbol.Symbol + :members: + +.. autoclass:: nnvm.symbol.Variable .. autofunction:: nnvm.symbol.Group diff --git a/nnvm/python/nnvm/symbol.py b/nnvm/python/nnvm/symbol.py index 9fa0af286..bc479a65e 100644 --- a/nnvm/python/nnvm/symbol.py +++ b/nnvm/python/nnvm/symbol.py @@ -47,6 +47,7 @@ class Symbol(SymbolBase): return self.handle.value def __add__(self, other): + """x.__add__(y) <=> x+y""" if isinstance(other, Symbol): return __add_symbol__(self, other) elif isinstance(other, _Number): @@ -58,6 +59,7 @@ class Symbol(SymbolBase): return self.__add__(other) def __sub__(self, other): + """x.__sub__(y) <=> x-y""" if isinstance(other, Symbol): return __sub_symbol__(self, other) if isinstance(other, _Number): @@ -72,6 +74,7 @@ class Symbol(SymbolBase): raise TypeError('type %s not supported' % str(type(other))) def __mul__(self, other): + """x.__mul__(y) <=> x*y""" if isinstance(other, Symbol): return __mul_symbol__(self, other) if isinstance(other, _Number): @@ -83,6 +86,7 @@ class Symbol(SymbolBase): return self.__mul__(other) def __div__(self, other): + """x.__div__(y) <=> x/y""" if isinstance(other, Symbol): return __div_symbol__(self, other) if isinstance(other, _Number): @@ -103,6 +107,7 @@ class Symbol(SymbolBase): return self.__rdiv__(other) def __pow__(self, other): + """x.__pow__(y) <=> x**y""" if isinstance(other, Symbol): return __pow_symbol__(self, other) if isinstance(other, _Number): @@ -117,12 +122,14 @@ class Symbol(SymbolBase): raise TypeError('type %s not supported' % str(type(other))) def __neg__(self): + """x.__neg__() <=> -x""" return self.__mul__(-1.0) def __copy__(self): return self.__deepcopy__() def __deepcopy__(self, _=None): + """Returns a deep copy of the input object.""" handle = _base.SymbolHandle() _base.check_call(_LIB.NNSymbolCopy(self.handle, _ctypes.byref(handle))) -- GitLab