Files
incubator-mxnet/python/mxnet/ndarray_doc.py
T
Mu Li 34eb88cd6e [doc] refactor python ndarray api (#5151)
* update ndarray doc

* update doc

* update

* more and fix css

* update

* update

* update

* fix css

* fix

* add comments for layers

* change slice to py_slice

* more

* more layers

* remove weight updating

* fix for perl-package.

* more symbol

* more symbol

* more symbol

* fix lint

* fix lint
2017-03-03 11:08:00 -08:00

39 lines
1.3 KiB
Python

# coding: utf-8
# pylint: disable=unused-argument, too-many-arguments
"""Extra symbol documents"""
from __future__ import absolute_import as _abs
import re as _re
from .base import build_param_doc as _build_param_doc
class NDArrayDoc(object):
"""The basic class"""
pass
def _build_doc(func_name,
desc,
arg_names,
arg_types,
arg_desc,
key_var_num_args=None,
ret_type=None):
"""Build docstring for imperative functions."""
param_str = _build_param_doc(arg_names, arg_types, arg_desc)
# if key_var_num_args:
# desc += '\nThis function support variable length of positional input.'
doc_str = ('%s\n\n' +
'%s\n' +
'out : NDArray, optional\n' +
' The output NDArray to hold the result.\n\n'+
'Returns\n' +
'-------\n' +
'out : NDArray or list of NDArray\n' +
' The output of this function.')
doc_str = doc_str % (desc, param_str)
extra_doc = "\n" + '\n'.join([x.__doc__ for x in type.__subclasses__(NDArrayDoc)
if x.__name__ == '%sDoc' % func_name])
doc_str += _re.sub(_re.compile(" "), "", extra_doc)
doc_str = _re.sub('ndarray-or-symbol', 'NDArray', doc_str)
return doc_str