Commit 1b5877f2 by Liangfu Chen Committed by Tianqi Chen

[DOCS] improve document of symbol; (#456)

parent 11ebd8d3
......@@ -3,5 +3,8 @@ nnvm.symbol
.. automodule:: nnvm.symbol
.. autoclass:: nnvm.symbol.Symbol
:members:
.. autoclass:: nnvm.symbol.Variable
.. autofunction:: nnvm.symbol.Group
......@@ -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)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment