예제 #1
0
def add_docstring_fcn(class_, method, descr):
    cls = getattr(sail.optimizers, class_)
    add_docstring(getattr(cls, method), descr)
예제 #2
0
def add_docstring_class(class_, descr):
    add_docstring(getattr(sail.optimizers, class_), descr)
예제 #3
0
def add_docstring_class(class_, descr):
    add_docstring(getattr(sail.modules, class_), descr)
예제 #4
0
def add_docstring_fcn(class_, method, descr):
    cls = getattr(sail.modules, class_)
    add_docstring(getattr(cls, method), descr)
예제 #5
0
	Tensor `x1` must have at least 2 dimensions

Args:
	x1 (Tensor): Input tensor to be filled
	gain (float): Scaling parameter


Examples:
	>>> x = sail.random.uniform(0, 1, (10))
	>>> sail.init.xavier_uniform(x, gain=0.5)
	tensor([[-0.06891035 0.24276903 0.33934638 0.15491413]
			[0.16111927 0.36402372 0.36035901 0.39027894]
			[0.23715521 0.31049126 -0.34743783 -0.39470020]
			[0.11064298 -0.00741466 -0.04901789 0.40659216]], shape=(4, 4))
	"""
add_docstring(sail.init.xavier_uniform, descr)

descr = r"""
sail.init.xavier_normal(x1, gain=1.0) -> Tensor
Fills the tensor `x1` with values generated from an xavier normal distribution :math:`\mathcal{{N}}(0, \text{std}^2)`

.. math::
	\text{std} = \text{gain} * \sqrt{\frac{2}{fan\_in + fan\_out}}

.. note::
	Xavier normal method originally described in `Understanding the difficulty of training deep feedforward neural networks <https://proceedings.mlr.press/v9/glorot10a/glorot10a.pdf>`_ (Glorot, X. & Bengio, Y., 2010)

.. note::
	Tensor `x1` must have at least 2 dimensions

Args:
예제 #6
0
파일: _sail_docs.py 프로젝트: sail-ml/sail
.. math::
	\text{out} = \text{x1} + \text{x2}

.. note::
	If tensor shapes do not match, they must be broadcastable to a common shape.

Args:
	x1 (Tensor): First Tensor
	x2 (Tensor): Second Tensor

Examples:
	>>> a = sail.random.uniform(0, 1, (20, 3))
	>>> b = sail.random.uniform(14, 15, (20, 3))
	>>> c = sail.add(a, b)
	"""
add_docstring(sail.add, descr)

descr = r"""
sail.subtract(x1, x2) -> Tensor
Returns the elementwise subtraction of Tensor `x2` from `x1`

.. math::
	\text{out} = \text{x1} - \text{x2}

.. note::
	If tensor shapes do not match, they must be broadcastable to a common shape.

Args:
	x1 (Tensor): First Tensor
	x2 (Tensor): Second Tensor
예제 #7
0
def add_docstring_fcn(method, descr):
    add_docstring(getattr(sail.Tensor, method), descr)