doc: change docstring style of C++ ops

This commit is contained in:
lzhengning 2021-03-08 17:15:33 +08:00
parent 3c6b5c3b53
commit 5dcf826ef1
3 changed files with 620 additions and 494 deletions

View File

@ -391,6 +391,15 @@ def sqr(x): return x*x
Var.sqr = sqr
def pow(x, y):
''' computes x^y, element-wise.
This operation is equivalent to ``x ** y``.
:param x: the first input.
:type x: a python number or jt.Var.
:param y: the second input.
:type y: a python number or jt.Var.
'''
if isinstance(y, (ori_int, ori_float)) and y == 2:
return x.sqr()
return core.ops.pow(x, y)

View File

@ -29,345 +29,391 @@ static auto make_number = get_op_info("number")
unordered_set<string> binary_ops = {
/**
* computes x^y, element-wise.
*
* This operation is equivalent to ``x ** y``.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
Computes ``x^y``, element-wise.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
*/
// @pybind(pow, __pow__)
"pow",
/**
* returns the element-wise maximum of x and y.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
Returns the element-wise maximum of ``x`` and ``y``.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
*/
"maximum",
/**
* returns the element-wise minimum of x and y.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
Returns the element-wise minimum of ``x`` and ``y``.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
*/
"minimum",
/**
* element-wise adds x and y and returns a new Var.
*
* This operation is equivalent to ``x + y``.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
Element-wise adds ``x`` and ``y`` and returns a new Var.
This operation is equivalent to ``x + y``.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
*/
// @pybind(add, __add__)
"add",
/**
* element-wise subtract y from x and returns a new Var.
*
* This operation is equivalent to ``x - y``.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
Element-wise subtract ``y`` from ``x`` and returns a new Var.
This operation is equivalent to ``x - y``.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
*/
// @pybind(subtract, __sub__)
"subtract",
/**
* element-wise muliplies x with y and returns a new Var.
*
* This operation is equivalent to ``x * y``.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
Element-wise muliplies ``x`` with ``y`` and returns a new Var.
This operation is equivalent to ``x * y``.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
*/
// @pybind(multiply, __mul__)
"multiply",
/**
* element-wise divide x by y and returns a new Var.
*
* This operation is equivalent to ``x / y``.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
*
* Example:
*
* >>> a = jt.empty((3,), dtype=jt.int32)
* >>> a
* jt.Var([707406378 707406378 707406378], dtype=int32)
* >>> b = jt.empty((3,), dtype=jt.int32)
* >>> b
* jt.Var([674510453 171649398 538976288], dtype=int32)
* >>> jt.divide(a, b)
* jt.Var([1.0487701 4.1212287 1.3125001], dtype=float32)
* >>> a / b
* jt.Var([1.0487701 4.1212287 1.3125001], dtype=float32)
*
* .. note ::
* returns float value even if the dtype of input Vars are both integers.
* @see jt.ops.floor_divide() for floor division.
Element-wise divide ``x`` by ``y`` and returns a new Var.
This operation is equivalent to ``x / y``.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
----------------
Example-1::
>>> a = jt.empty((3,), dtype=jt.int32)
>>> a
jt.Var([707406378 707406378 707406378], dtype=int32)
>>> b = jt.empty((3,), dtype=jt.int32)
>>> b
jt.Var([674510453 171649398 538976288], dtype=int32)
>>> jt.divide(a, b)
jt.Var([1.0487701 4.1212287 1.3125001], dtype=float32)
>>> a / b
jt.Var([1.0487701 4.1212287 1.3125001], dtype=float32)
.. note ::
returns float value even if the dtype of input Vars are both integers.
@see jt.ops.floor_divide() for floor division.
*/
// @pybind(divide, __truediv__)
"divide",
/**
* element-wise divide x by y and returns the floor of the result.
*
* This operation is equivalent to ``x // y``.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
*
* Example:
*
* >>> a = jt.randint(1, 10, (3,), dtype=jt.int32)
* >>> a
* jt.Var([9 2 7], dtype=int32)
* >>> b = jt.randint(1, 10, (3,), dtype=jt.int32)
* >>> b
* jt.Var([6 4 6], dtype=int32)
* >>> jt.floor_divide(a, b)
* jt.Var([1 0 1], dtype=int32)
* >>> a // b
* jt.Var([1 0 1], dtype=int32)
Element-wise divide ``x`` by ``y`` and returns the floor of the result.
This operation is equivalent to ``x // y``.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
----------------
Example-1::
>>> a = jt.randint(1, 10, (3,), dtype=jt.int32)
>>> a
jt.Var([9 2 7], dtype=int32)
>>> b = jt.randint(1, 10, (3,), dtype=jt.int32)
>>> b
jt.Var([6 4 6], dtype=int32)
>>> jt.floor_divide(a, b)
jt.Var([1 0 1], dtype=int32)
>>> a // b
jt.Var([1 0 1], dtype=int32)
*/
// @pybind(floor_divide, __floordiv__)
"floor_divide",
/**
* returns the element-wise remainder of division.
*
* This operation is equivalent to ``x % y``.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
*
* Example:
*
* >>> a = jt.rand(3)
* >>> a
* jt.Var([0.3989529 0.20159635 0.22973768], dtype=float32)
* >>> b = jt.rand(3)
* >>> b
* jt.Var([0.20121202 0.7704864 0.5654395 ], dtype=float32)
* >>> jt.mod(a, b)
* jt.Var([0.19774088 0.20159635 0.22973768], dtype=float32)
* >>> a % b
* jt.Var([0.19774088 0.20159635 0.22973768], dtype=float32)
Returns the element-wise remainder of division.
This operation is equivalent to ``x % y``.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
----------------
Example-1::
>>> a = jt.rand(3)
>>> a
jt.Var([0.3989529 0.20159635 0.22973768], dtype=float32)
>>> b = jt.rand(3)
>>> b
jt.Var([0.20121202 0.7704864 0.5654395 ], dtype=float32)
>>> jt.mod(a, b)
jt.Var([0.19774088 0.20159635 0.22973768], dtype=float32)
>>> a % b
jt.Var([0.19774088 0.20159635 0.22973768], dtype=float32)
*/
// @pybind(mod, __mod__)
"mod",
/**
* returns x < y element-wise.
*
* This operation is equivalent to ``x < y``.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
Returns ``x < y`` element-wise.
This operation is equivalent to ``x < y``.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
*/
// @pybind(less, __lt__)
"less",
/**
* returns x <= y element-wise.
*
* This operation is equivalent to ``x <= y``.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
Returns ``x <= y`` element-wise.
This operation is equivalent to ``x <= y``.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
*/
// @pybind(less_equal, __le__)
"less_equal",
/**
* returns x > y element-wise.
*
* This operation is equivalent to ``x > y``.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
Returns ``x > y`` element-wise.
This operation is equivalent to ``x > y``.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
*/
// @pybind(greater, __gt__)
"greater",
/**
* returns x >= y element-wise.
*
* This operation is equivalent to ``x >= y``.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
Returns ``x >= y`` element-wise.
This operation is equivalent to ``x >= y``.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
*/
// @pybind(greater_equal, __ge__)
"greater_equal",
/**
* returns x == y element-wise.
*
* This operation is equivalent to ``x == y``.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
Returns ``x == y`` element-wise.
This operation is equivalent to ``x == y``.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
*/
// @pybind(equal, __eq__)
"equal",
/**
* returns x != y element-wise.
*
* This operation is equivalent to ``x != y``.
*
* :param x: the first input.
* :type x: a python number or jt.Var.
* :param y: the second input.
* :type y: a python number or jt.Var.
Returns ``x != y`` element-wise.
This operation is equivalent to ``x != y``.
----------------
* [in] x: the first input, a python number or jt.Var.
* [in] y: the second input, a python number or jt.Var.
*/
// @pybind(not_equal, __ne__)
"not_equal",
/**
* shifts the bits of x to the left by y.
*
* Bits are shifted to the left by appending ``y`` 0s at the right of ``x``.
* This operation is equivalent to ``x << y``.
*
* :param x: the first input.
* :type x: a python integer, or jt.Var (int32 or int64 types).
* :param y: the second input.
* :type y: a python integer, or jt.Var (int32 or int64 types).
*
* Example:
* >>> a = jt.randint(0, 10, shape=(3,))
* >>> a
* jt.Var([7 6 7], dtype=int32)
* >>> b = jt.randint(0, 10, shape=(3,))
* >>> b
* jt.Var([3 9 8], dtype=int32)
* >>> jt.left_shift(a, b)
* jt.Var([ 56 3072 1792], dtype=int32)
* >>> a << b
* jt.Var([ 56 3072 1792], dtype=int32)
Shifts the bits of ``x`` to the left by ``y``.
Bits are shifted to the left by appending ``y`` 0s at the right of ``x``.
This operation is equivalent to ``x << y``.
----------------
* [in] x: the first input, a python number or jt.Var (int32 or int64).
* [in] y: the second input, a python number or jt.Var (int32 or int64).
----------------
Example-1::
>>> a = jt.randint(0, 10, shape=(3,))
>>> a
jt.Var([7 6 7], dtype=int32)
>>> b = jt.randint(0, 10, shape=(3,))
>>> b
jt.Var([3 9 8], dtype=int32)
>>> jt.left_shift(a, b)
jt.Var([ 56 3072 1792], dtype=int32)
>>> a << b
jt.Var([ 56 3072 1792], dtype=int32)
*/
// @pybind(left_shift, __lshift__)
"left_shift",
/**
* shifts the bits of x to the right by y.
*
* This operation is equivalent to ``x >> y``.
*
* :param x: the first input.
* :type x: a python integer, or jt.Var (int32 or int64 types).
* :param y: the second input.
* :type y: a python integer, or jt.Var (int32 or int64 types).
*
* Example:
* >>> a = jt.randint(0, 1024, shape=(3,))
* >>> a
* jt.Var([439 113 92], dtype=int32)
* >>> b = jt.randint(0, 10, shape=(3,))
* >>> b
* jt.Var([6 8 4], dtype=int32)
* >>> jt.right_shift(a, b)
* jt.Var([6 0 5], dtype=int32)
Shifts the bits of ``x`` to the right by ``y``.
This operation is equivalent to ``x >> y``.
----------------
* [in] x: the first input, a python number or jt.Var (int32 or int64).
* [in] y: the second input, a python number or jt.Var (int32 or int64).
----------------
Example-1::
>>> a = jt.randint(0, 1024, shape=(3,))
>>> a
jt.Var([439 113 92], dtype=int32)
>>> b = jt.randint(0, 10, shape=(3,))
>>> b
jt.Var([6 8 4], dtype=int32)
>>> jt.right_shift(a, b)
jt.Var([6 0 5], dtype=int32)
*/
// @pybind(right_shift, __rshift__)
"right_shift",
/**
* returns the element-wise logical AND of the inputs.
*
* :param x: the first input.
* :type x: jt.Var.
* :param y: the second input.
* :type y: jt.Var.
Returns the element-wise logical AND of the inputs.
----------------
* [in] x: the first input, jt.Var.
* [in] y: the second input, jt.Var.
*/
"logical_and",
/**
* returns the element-wise logical OR of the inputs.
*
* :param x: the first input.
* :type x: jt.Var.
* :param y: the second input.
* :type y: jt.Var.
Returns the element-wise logical OR of the inputs.
----------------
* [in] x: the first input, jt.Var.
* [in] y: the second input, jt.Var.
*/
"logical_or",
/**
* returns the element-wise logical XOR of the inputs.
*
* :param x: the first input.
* :type x: jt.Var.
* :param y: the second input.
* :type y: jt.Var.
Returns the element-wise logical XOR of the inputs.
----------------
* [in] x: the first input, jt.Var.
* [in] y: the second input, jt.Var.
*/
"logical_xor",
/**
* Computes the bitwise AND of x and y.
*
* :param x: the first input.
* :type x: jt.Var (integal or boolean types).
* :param y: the second input.
* :type y: jt.Var (integal or boolean types).
Computes the bitwise AND of x and y.
----------------
* [in] x: the first input, jt.Var (integal or boolean).
* [in] y: the second input, jt.Var (integal or boolean).
*/
// @pybind(bitwise_and, __and__)
"bitwise_and",
/**
* Computes the bitwise OR of x and y.
*
* :param x: the first input.
* :type x: jt.Var (integal or boolean types).
* :param y: the second input.
* :type y: jt.Var (integal or boolean types).
Computes the bitwise OR of x and y.
----------------
* [in] x: the first input, jt.Var (integal or boolean).
* [in] y: the second input, jt.Var (integal or boolean).
*/
// @pybind(bitwise_or, __or__)
"bitwise_or",
/**
* Computes the bitwise XOR of x and y.
*
* :param x: the first input.
* :type x: jt.Var (integal or boolean types).
* :param y: the second input.
* :type y: jt.Var (integal or boolean types).
Computes the bitwise XOR of x and y.
----------------
* [in] x: the first input, jt.Var (integal or boolean).
* [in] y: the second input, jt.Var (integal or boolean).
*/
// @pybind(bitwise_xor, __xor__)
"bitwise_xor",

View File

@ -37,367 +37,438 @@ static unordered_set<string> unary_ops = {
// please keep float64 the last type
/**
* returns the absolute value of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> jt.abs(jt.float32([-1, 0, 1]))
* jt.Var([1. 0. 1.], dtype=float32)
Returns the absolute value of the input ``x``.
----------------
* [in] x: the input jt.Var
----------------
Example-1::
>>> jt.abs(jt.float32([-1, 0, 1]))
jt.Var([1. 0. 1.], dtype=float32)
*/
// @pybind(abs, __abs__)
"abs",
/**
* returns the negative value of x.
*
* This operator is equavilant to ``-x``.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> jt.negative(jt.float32([-1, 0, 1]))
* jt.Var([ 1. -0. -1.], dtype=float32)
Returns the negative value of the input ``x``.
This operator is equavilant to ``-x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> jt.negative(jt.float32([-1, 0, 1]))
jt.Var([ 1. -0. -1.], dtype=float32)
*/
// @pybind(negative, __neg__)
"negative",
/**
* returns the logical NOT of x.
*
* :param x: the input.
* :type x: jt.Var (integal or boolean types).
*
* Example:
* >>> jt.logical_not(jt.int32([-1, 0, 1]))
* jt.Var([False True False], dtype=bool)
Returns the logical NOT of the input ``x``.
----------------
* [in] x: the input jt.Var, integal or boolean.
----------------
Example-1::
>>> jt.logical_not(jt.int32([-1, 0, 1]))
jt.Var([False True False], dtype=bool)
*/
"logical_not",
/**
* returns the bitwise NOT of x.
*
* :param x: the input.
* :type x: jt.Var (integal or boolean types).
*
* Example:
* >>> jt.bitwise_not(jt.int32([1, 2, -3]))
* jt.Var([-2 -3 2], dtype=int32)
Returns the bitwise NOT of the input ``x``.
----------------
* [in] x: the input jt.Var, integal or boolean.
----------------
Example-1::
>>> jt.bitwise_not(jt.int32([1, 2, -3]))
jt.Var([-2 -3 2], dtype=int32)
*/
"bitwise_not",
/**
* returns the natural logarithm of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.rand(4) * 2
* >>> a
* jt.Var([0.02863695 1.30122 1.6048753 1.140261 ], dtype=float32)
* >>> jt.log(a)
* jt.Var([-3.5530574 0.26330233 0.47304606 0.13125724], dtype=float32)
Returns the natural logarithm of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.rand(4) * 2
>>> a
jt.Var([0.02863695 1.30122 1.6048753 1.140261 ], dtype=float32)
>>> jt.log(a)
jt.Var([-3.5530574 0.26330233 0.47304606 0.13125724], dtype=float32)
*/
"log",
/**
* returns the exponential of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.rand(4) * 2
* >>> a
* jt.Var([1.9841381 1.4103996 0.5855549 1.4212812], dtype=float32)
* >>> jt.exp(a)
* jt.Var([7.2727766 4.0975924 1.7959872 4.1424246], dtype=float32)
Returns the exponential of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.rand(4) * 2
>>> a
jt.Var([1.9841381 1.4103996 0.5855549 1.4212812], dtype=float32)
>>> jt.exp(a)
jt.Var([7.2727766 4.0975924 1.7959872 4.1424246], dtype=float32)
*/
"exp",
/**
* returns the square root of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.rand(4) * 2
* >>> a
* jt.Var([0.81957287 0.5609612 0.07435933 1.7571875 ], dtype=float32)
* >>> jt.sqrt(a)
* jt.Var([0.90530264 0.7489734 0.27268907 1.3255895 ], dtype=float32)
Returns the square root of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.rand(4) * 2
>>> a
jt.Var([0.81957287 0.5609612 0.07435933 1.7571875 ], dtype=float32)
>>> jt.sqrt(a)
jt.Var([0.90530264 0.7489734 0.27268907 1.3255895 ], dtype=float32)
*/
"sqrt",
/**
* returns the closest integer of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.randn(4)
* >>> a
* jt.Var([ 2.101595 0.33055413 -0.44147047 -0.7720668 ], dtype=float32)
* >>> jt.round(a)
* jt.Var([ 2 0 0 -1], dtype=int32)
Returns the closest integer of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.randn(4)
>>> a
jt.Var([ 2.101595 0.33055413 -0.44147047 -0.7720668 ], dtype=float32)
>>> jt.round(a)
jt.Var([ 2 0 0 -1], dtype=int32)
*/
"round",
/**
* returns the largest integer less than or equal to x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.randn(4)
* >>> a
* jt.Var([-1.0339162 -0.7259972 -0.9220003 -0.8449701], dtype=float32)
* >>> jt.floor(a)
* jt.Var([-2 -1 -1 -1], dtype=int32)
Returns the largest integer less than or equal to the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.randn(4)
>>> a
jt.Var([-1.0339162 -0.7259972 -0.9220003 -0.8449701], dtype=float32)
>>> jt.floor(a)
jt.Var([-2 -1 -1 -1], dtype=int32)
*/
"floor",
/**
* returns the smallest integer greater than or equal to x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.randn(4)
* >>> a
* jt.Var([-1.0339162 -0.7259972 -0.9220003 -0.8449701], dtype=float32)
* >>> jt.ceil(a)
* jt.Var([-1 0 0 0], dtype=int32)
Returns the smallest integer greater than or equal to the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.randn(4)
>>> a
jt.Var([-1.0339162 -0.7259972 -0.9220003 -0.8449701], dtype=float32)
>>> jt.ceil(a)
jt.Var([-1 0 0 0], dtype=int32)
*/
"ceil",
/**
* returns the sine of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.randn(4)
* >>> a
* jt.Var([ 0.32893723 -0.7112559 -0.872391 1.8001337 ], dtype=float32)
* >>> jt.sin(a)
* jt.Var([ 0.32303742 -0.6527857 -0.76586854 0.9738172 ], dtype=float32)
Returns the sine of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.randn(4)
>>> a
jt.Var([ 0.32893723 -0.7112559 -0.872391 1.8001337 ], dtype=float32)
>>> jt.sin(a)
jt.Var([ 0.32303742 -0.6527857 -0.76586854 0.9738172 ], dtype=float32)
*/
"sin",
/**
* returns the arcsine of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.randn(4)
* >>> a
* jt.Var([ 0.09342023 -0.42522037 0.9264933 -0.785264 ], dtype=float32)
* >>> jt.asin(a)
* jt.Var([ 0.09355665 -0.43920535 1.1849847 -0.9031224 ], dtype=float32)
Returns the arcsine of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.randn(4)
>>> a
jt.Var([ 0.09342023 -0.42522037 0.9264933 -0.785264 ], dtype=float32)
>>> jt.asin(a)
jt.Var([ 0.09355665 -0.43920535 1.1849847 -0.9031224 ], dtype=float32)
*/
// @pybind(asin, arcsin)
"asin",
/**
* returns the hyperbolic sine of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.randn(4)
* >>> a
* jt.Var([ 0.32893723 -0.7112559 -0.872391 1.8001337 ], dtype=float32)
* >>> jt.sinh(a)
* jt.Var([ 0.3349012 -0.77276015 -0.9873369 2.9425898 ], dtype=float32)
Returns the hyperbolic sine of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.randn(4)
>>> a
jt.Var([ 0.32893723 -0.7112559 -0.872391 1.8001337 ], dtype=float32)
>>> jt.sinh(a)
jt.Var([ 0.3349012 -0.77276015 -0.9873369 2.9425898 ], dtype=float32)
*/
// @pybind(asin, arcsin)
"sinh",
/**
* returns the inverse hyperbolic sine of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.randn(4)
* >>> a
* jt.Var([-1.9749726 -0.52341473 0.8906148 1.0338128 ], dtype=float32)
* >>> jt.asinh(a)
* jt.Var([-1.4323865 -0.5020559 0.8018747 0.90508187], dtype=float32)
Returns the inverse hyperbolic sine of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.randn(4)
>>> a
jt.Var([-1.9749726 -0.52341473 0.8906148 1.0338128 ], dtype=float32)
>>> jt.asinh(a)
jt.Var([-1.4323865 -0.5020559 0.8018747 0.90508187], dtype=float32)
*/
// @pybind(asinh, arcsinh)
"asinh",
/**
* returns the tangent of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.randn(4)
* >>> a
* jt.Var([ 0.32893723 -0.7112559 -0.872391 1.8001337 ], dtype=float32)
* >>> jt.tan(a)
* jt.Var([ 0.34133783 -0.8617148 -1.1910915 -4.283673 ], dtype=float32)
Returns the tangent of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.randn(4)
>>> a
jt.Var([ 0.32893723 -0.7112559 -0.872391 1.8001337 ], dtype=float32)
>>> jt.tan(a)
jt.Var([ 0.34133783 -0.8617148 -1.1910915 -4.283673 ], dtype=float32)
*/
"tan",
/**
* returns the inverse tangent of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.randn(4)
* >>> a
* jt.Var([-0.85885596 1.187804 0.47249675 0.95933187], dtype=float32)
* >>> jt.atan(a)
* jt.Var([-0.70961297 0.87102956 0.44140393 0.76464504], dtype=float32)
Returns the inverse tangent of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.randn(4)
>>> a
jt.Var([-0.85885596 1.187804 0.47249675 0.95933187], dtype=float32)
>>> jt.atan(a)
jt.Var([-0.70961297 0.87102956 0.44140393 0.76464504], dtype=float32)
*/
// @pybind(atan, arctan)
"atan",
/**
* returns the hyperbolic tangent of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.randn(4)
* >>> a
* jt.Var([-0.85885596 1.187804 0.47249675 0.95933187], dtype=float32)
* >>> jt.tanh(a)
* jt.Var([-0.6956678 0.82989657 0.4402144 0.7439787 ], dtype=float32)
Returns the hyperbolic tangent of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.randn(4)
>>> a
jt.Var([-0.85885596 1.187804 0.47249675 0.95933187], dtype=float32)
>>> jt.tanh(a)
jt.Var([-0.6956678 0.82989657 0.4402144 0.7439787 ], dtype=float32)
*/
"tanh",
/**
* returns the inverse hyperbolic tangent of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.rand(4) * 2 - 1
* >>> a
* jt.Var([ 0.9062414 -0.799802 -0.27219176 -0.7274077 ], dtype=float32)
* >>> jt.atanh(a)
* jt.Var([ 1.5060828 -1.0980625 -0.27922946 -0.9231999 ], dtype=float32)
Returns the inverse hyperbolic tangent of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.rand(4) * 2 - 1
>>> a
jt.Var([ 0.9062414 -0.799802 -0.27219176 -0.7274077 ], dtype=float32)
>>> jt.atanh(a)
jt.Var([ 1.5060828 -1.0980625 -0.27922946 -0.9231999 ], dtype=float32)
*/
// @pybind(atanh, arctanh)
"atanh",
/**
* returns the cosine of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.randn(4)
* >>> a
* jt.Var([ 0.32893723 -0.7112559 -0.872391 1.8001337 ], dtype=float32)
* >>> jt.cos(a)
* jt.Var([ 0.9463862 0.7575426 0.6429972 -0.2273323], dtype=float32)
Returns the cosine of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.randn(4)
>>> a
jt.Var([ 0.32893723 -0.7112559 -0.872391 1.8001337 ], dtype=float32)
>>> jt.cos(a)
jt.Var([ 0.9463862 0.7575426 0.6429972 -0.2273323], dtype=float32)
*/
"cos",
/**
* returns the inverse cosine of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.rand(4) * 2 - 1
* >>> a
* jt.Var([ 0.5876564 0.740723 -0.667666 0.5371753], dtype=float32)
* >>> jt.acos(a)
* jt.Var([0.9426371 0.7366504 2.3018656 1.0037117], dtype=float32)
Returns the inverse cosine of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.rand(4) * 2 - 1
>>> a
jt.Var([ 0.5876564 0.740723 -0.667666 0.5371753], dtype=float32)
>>> jt.acos(a)
jt.Var([0.9426371 0.7366504 2.3018656 1.0037117], dtype=float32)
*/
// @pybind(acos, arccos)
"acos",
/**
* returns the hyperbolic cosine of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.randn(4)
* >>> a
* jt.Var([ 0.32893723 -0.7112559 -0.872391 1.8001337 ], dtype=float32)
* >>> jt.cosh(a)
* jt.Var([1.0545894 1.2637873 1.405288 3.1078668], dtype=float32)
Returns the hyperbolic cosine of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.randn(4)
>>> a
jt.Var([ 0.32893723 -0.7112559 -0.872391 1.8001337 ], dtype=float32)
>>> jt.cosh(a)
jt.Var([1.0545894 1.2637873 1.405288 3.1078668], dtype=float32)
*/
"cosh",
/**
* returns the inverse hyperbolic cosine of x.
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.rand(4) + 1
* >>> a
* jt.Var([1.3609099 1.8137748 1.1146184 1.3911307], dtype=float32)
* >>> jt.acosh(a)
* jt.Var([0.8259237 1.2020639 0.47432774 0.8579033 ], dtype=float32)
Returns the inverse hyperbolic cosine of the input ``x``.
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.rand(4) + 1
>>> a
jt.Var([1.3609099 1.8137748 1.1146184 1.3911307], dtype=float32)
>>> jt.acosh(a)
jt.Var([0.8259237 1.2020639 0.47432774 0.8579033 ], dtype=float32)
*/
// @pybind(acosh, arccosh)
"acosh",
/**
* returns the sigmoid of x.
*
* .. math::
* out_i = \frac{1}{1 + e^{x_i}}
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.randn(4)
* >>> a
* jt.Var([ 0.49443012 0.4305426 -1.0364404 -1.2628382 ], dtype=float32)
* >>> jt.sigmoid(a)
* jt.Var([0.62114954 0.6060032 0.2618374 0.2204857 ], dtype=float32)
Returns the sigmoid of the input ``x``.
.. math::
out_i = \frac{1}{1 + e^{x_i}}
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.randn(4)
>>> a
jt.Var([ 0.49443012 0.4305426 -1.0364404 -1.2628382 ], dtype=float32)
>>> jt.sigmoid(a)
jt.Var([0.62114954 0.6060032 0.2618374 0.2204857 ], dtype=float32)
*/
"sigmoid",
/**
* Computes the error function of each element. The error function is defined as follows:
*
* .. math::
* erf(x) = \frac{2}{\sqrt{\pi}} \int_0^x e^{-t^2} dt
*
* :param x: the input.
* :type x: jt.Var.
*
* Example:
* >>> a = jt.randn(4)
* >>> a
* jt.Var([ 0.49443012 0.4305426 -1.0364404 -1.2628382 ], dtype=float32)
* >>> jt.erf(a)
* jt.Var([ 0.51559156 0.45739546 -0.85728306 -0.9258883 ], dtype=float32)
Computes the error function of each element. The error function is defined as follows:
.. math::
erf(x) = \frac{2}{\sqrt{\pi}} \int_0^x e^{-t^2} dt
----------------
* [in] x: the input jt.Var.
----------------
Example-1::
>>> a = jt.randn(4)
>>> a
jt.Var([ 0.49443012 0.4305426 -1.0364404 -1.2628382 ], dtype=float32)
>>> jt.erf(a)
jt.Var([ 0.51559156 0.45739546 -0.85728306 -0.9258883 ], dtype=float32)
*/
"erf",
};