提交 88dfd88f authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Rename _scal_elemwise to scalar_elemwise

上级 e701d8f8
...@@ -27,7 +27,7 @@ from theano.scalar import int32 ...@@ -27,7 +27,7 @@ from theano.scalar import int32
from theano.tensor import elemwise from theano.tensor import elemwise
# set up the external interface # set up the external interface
from theano.tensor.elemwise import CAReduce, DimShuffle, Elemwise, Sum, _scal_elemwise from theano.tensor.elemwise import CAReduce, DimShuffle, Elemwise, Sum, scalar_elemwise
from theano.tensor.type import TensorType, values_eq_approx_always_true from theano.tensor.type import TensorType, values_eq_approx_always_true
from theano.tensor.type_other import NoneConst from theano.tensor.type_other import NoneConst
from theano.tensor.utils import as_list from theano.tensor.utils import as_list
...@@ -1853,37 +1853,37 @@ def largest(*args): ...@@ -1853,37 +1853,37 @@ def largest(*args):
########################## ##########################
@_scal_elemwise @scalar_elemwise
def lt(a, b): def lt(a, b):
"""a < b""" """a < b"""
@_scal_elemwise @scalar_elemwise
def gt(a, b): def gt(a, b):
"""a > b""" """a > b"""
@_scal_elemwise @scalar_elemwise
def le(a, b): def le(a, b):
"""a <= b""" """a <= b"""
@_scal_elemwise @scalar_elemwise
def ge(a, b): def ge(a, b):
"""a >= b""" """a >= b"""
@_scal_elemwise @scalar_elemwise
def eq(a, b): def eq(a, b):
"""a == b""" """a == b"""
@_scal_elemwise @scalar_elemwise
def neq(a, b): def neq(a, b):
"""a != b""" """a != b"""
@_scal_elemwise @scalar_elemwise
def isnan(a): def isnan(a):
"""isnan(a)""" """isnan(a)"""
...@@ -1903,7 +1903,7 @@ def isnan(a): ...@@ -1903,7 +1903,7 @@ def isnan(a):
return isnan_(a) return isnan_(a)
@_scal_elemwise @scalar_elemwise
def isinf(a): def isinf(a):
"""isinf(a)""" """isinf(a)"""
...@@ -2068,7 +2068,7 @@ def isclose(a, b, rtol=1.0e-5, atol=1.0e-8, equal_nan=False): ...@@ -2068,7 +2068,7 @@ def isclose(a, b, rtol=1.0e-5, atol=1.0e-8, equal_nan=False):
########################## ##########################
@_scal_elemwise @scalar_elemwise
def switch(cond, ift, iff): def switch(cond, ift, iff):
"""if cond then ift else iff""" """if cond then ift else iff"""
...@@ -2079,7 +2079,7 @@ where = switch ...@@ -2079,7 +2079,7 @@ where = switch
########################## ##########################
@_scal_elemwise @scalar_elemwise
def and_(a, b): def and_(a, b):
"""bitwise a & b""" """bitwise a & b"""
...@@ -2087,7 +2087,7 @@ def and_(a, b): ...@@ -2087,7 +2087,7 @@ def and_(a, b):
bitwise_and = and_ # numpy name for it bitwise_and = and_ # numpy name for it
@_scal_elemwise @scalar_elemwise
def or_(a, b): def or_(a, b):
"""bitwise a | b""" """bitwise a | b"""
...@@ -2095,7 +2095,7 @@ def or_(a, b): ...@@ -2095,7 +2095,7 @@ def or_(a, b):
bitwise_or = or_ # numpy name for it bitwise_or = or_ # numpy name for it
@_scal_elemwise @scalar_elemwise
def xor(a, b): def xor(a, b):
"""bitwise a ^ b""" """bitwise a ^ b"""
...@@ -2103,7 +2103,7 @@ def xor(a, b): ...@@ -2103,7 +2103,7 @@ def xor(a, b):
bitwise_xor = xor # numpy name for it bitwise_xor = xor # numpy name for it
@_scal_elemwise @scalar_elemwise
def invert(a): def invert(a):
"""bitwise ~a""" """bitwise ~a"""
...@@ -2116,7 +2116,7 @@ bitwise_not = invert # numpy alias for it ...@@ -2116,7 +2116,7 @@ bitwise_not = invert # numpy alias for it
########################## ##########################
@_scal_elemwise @scalar_elemwise
def abs_(a): def abs_(a):
"""|`a`| """|`a`|
...@@ -2129,69 +2129,69 @@ def abs_(a): ...@@ -2129,69 +2129,69 @@ def abs_(a):
pprint.assign(abs_, printing.PatternPrinter(("|%(0)s|", -1000))) pprint.assign(abs_, printing.PatternPrinter(("|%(0)s|", -1000)))
@_scal_elemwise @scalar_elemwise
def exp(a): def exp(a):
"""e^`a`""" """e^`a`"""
@_scal_elemwise @scalar_elemwise
def exp2(a): def exp2(a):
"""2^`a`""" """2^`a`"""
@_scal_elemwise @scalar_elemwise
def expm1(a): def expm1(a):
"""e^`a` - 1""" """e^`a` - 1"""
@_scal_elemwise @scalar_elemwise
def neg(a): def neg(a):
"""-a""" """-a"""
# numpy.reciprocal does integer division on integer inputs # numpy.reciprocal does integer division on integer inputs
# (which is not very interesting) # (which is not very interesting)
@_scal_elemwise @scalar_elemwise
def inv(a): def inv(a):
"""1.0/a""" """1.0/a"""
@_scal_elemwise @scalar_elemwise
def log(a): def log(a):
"""base e logarithm of a""" """base e logarithm of a"""
@_scal_elemwise @scalar_elemwise
def log2(a): def log2(a):
"""base 2 logarithm of a""" """base 2 logarithm of a"""
@_scal_elemwise @scalar_elemwise
def log10(a): def log10(a):
"""base 10 logarithm of a""" """base 10 logarithm of a"""
@_scal_elemwise @scalar_elemwise
def log1p(a): def log1p(a):
"""log(1+a)""" """log(1+a)"""
@_scal_elemwise @scalar_elemwise
def sgn(a): def sgn(a):
"""sign of a""" """sign of a"""
@_scal_elemwise @scalar_elemwise
def ceil(a): def ceil(a):
"""ceiling of a""" """ceiling of a"""
@_scal_elemwise @scalar_elemwise
def floor(a): def floor(a):
"""floor of a""" """floor of a"""
@_scal_elemwise @scalar_elemwise
def trunc(a): def trunc(a):
"""trunc of a""" """trunc of a"""
...@@ -2223,17 +2223,17 @@ def round(a, mode=None): ...@@ -2223,17 +2223,17 @@ def round(a, mode=None):
raise Exception(f"round mode {mode} is not implemented.") raise Exception(f"round mode {mode} is not implemented.")
@_scal_elemwise @scalar_elemwise
def round_half_to_even(a): def round_half_to_even(a):
"""round_half_to_even(a)""" """round_half_to_even(a)"""
@_scal_elemwise @scalar_elemwise
def round_half_away_from_zero(a): def round_half_away_from_zero(a):
"""round_half_away_from_zero(a)""" """round_half_away_from_zero(a)"""
@_scal_elemwise @scalar_elemwise
def sqr(a): def sqr(a):
"""square of a""" """square of a"""
...@@ -2303,187 +2303,187 @@ def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None, aweights=N ...@@ -2303,187 +2303,187 @@ def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None, aweights=N
return c.squeeze() return c.squeeze()
@_scal_elemwise @scalar_elemwise
def sqrt(a): def sqrt(a):
"""square root of a""" """square root of a"""
@_scal_elemwise @scalar_elemwise
def deg2rad(a): def deg2rad(a):
"""convert degree a to radian""" """convert degree a to radian"""
@_scal_elemwise @scalar_elemwise
def rad2deg(a): def rad2deg(a):
"""convert radian a to degree""" """convert radian a to degree"""
@_scal_elemwise @scalar_elemwise
def cos(a): def cos(a):
"""cosine of a""" """cosine of a"""
@_scal_elemwise @scalar_elemwise
def arccos(a): def arccos(a):
"""arccosine of a""" """arccosine of a"""
@_scal_elemwise @scalar_elemwise
def sin(a): def sin(a):
"""sine of a""" """sine of a"""
@_scal_elemwise @scalar_elemwise
def arcsin(a): def arcsin(a):
"""arcsine of a""" """arcsine of a"""
@_scal_elemwise @scalar_elemwise
def tan(a): def tan(a):
"""tangent of a""" """tangent of a"""
@_scal_elemwise @scalar_elemwise
def arctan(a): def arctan(a):
"""arctangent of a""" """arctangent of a"""
@_scal_elemwise @scalar_elemwise
def arctan2(a, b): def arctan2(a, b):
"""arctangent of a / b""" """arctangent of a / b"""
@_scal_elemwise @scalar_elemwise
def cosh(a): def cosh(a):
"""hyperbolic cosine of a""" """hyperbolic cosine of a"""
@_scal_elemwise @scalar_elemwise
def arccosh(a): def arccosh(a):
"""hyperbolic arc cosine of a""" """hyperbolic arc cosine of a"""
@_scal_elemwise @scalar_elemwise
def sinh(a): def sinh(a):
"""hyperbolic sine of a""" """hyperbolic sine of a"""
@_scal_elemwise @scalar_elemwise
def arcsinh(a): def arcsinh(a):
"""hyperbolic arc sine of a""" """hyperbolic arc sine of a"""
@_scal_elemwise @scalar_elemwise
def tanh(a): def tanh(a):
"""hyperbolic tangent of a""" """hyperbolic tangent of a"""
@_scal_elemwise @scalar_elemwise
def arctanh(a): def arctanh(a):
"""hyperbolic arc tangent of a""" """hyperbolic arc tangent of a"""
@_scal_elemwise @scalar_elemwise
def erf(a): def erf(a):
"""error function""" """error function"""
@_scal_elemwise @scalar_elemwise
def erfc(a): def erfc(a):
"""complementary error function""" """complementary error function"""
@_scal_elemwise @scalar_elemwise
def erfcx(a): def erfcx(a):
"""scaled complementary error function""" """scaled complementary error function"""
@_scal_elemwise @scalar_elemwise
def erfinv(a): def erfinv(a):
"""inverse error function""" """inverse error function"""
@_scal_elemwise @scalar_elemwise
def erfcinv(a): def erfcinv(a):
"""inverse complementary error function""" """inverse complementary error function"""
@_scal_elemwise @scalar_elemwise
def gamma(a): def gamma(a):
"""gamma function""" """gamma function"""
@_scal_elemwise @scalar_elemwise
def gammaln(a): def gammaln(a):
"""log gamma function""" """log gamma function"""
@_scal_elemwise @scalar_elemwise
def psi(a): def psi(a):
"""derivative of log gamma function""" """derivative of log gamma function"""
@_scal_elemwise @scalar_elemwise
def tri_gamma(a): def tri_gamma(a):
"""second derivative of the log gamma function""" """second derivative of the log gamma function"""
@_scal_elemwise @scalar_elemwise
def chi2sf(x, k): def chi2sf(x, k):
"""chi squared survival function""" """chi squared survival function"""
@_scal_elemwise @scalar_elemwise
def gammainc(k, x): def gammainc(k, x):
"""Regularized lower gamma function""" """Regularized lower gamma function"""
@_scal_elemwise @scalar_elemwise
def gammaincc(k, x): def gammaincc(k, x):
"""Regularized upper gamma function""" """Regularized upper gamma function"""
@_scal_elemwise @scalar_elemwise
def gammau(k, x): def gammau(k, x):
"""Upper incomplete gamma function.""" """Upper incomplete gamma function."""
@_scal_elemwise @scalar_elemwise
def gammal(k, x): def gammal(k, x):
"""Lower incomplete gamma function.""" """Lower incomplete gamma function."""
@_scal_elemwise @scalar_elemwise
def j0(x): def j0(x):
"""Bessel function of the first kind of order 0.""" """Bessel function of the first kind of order 0."""
@_scal_elemwise @scalar_elemwise
def j1(x): def j1(x):
"""Bessel function of the first kind of order 1.""" """Bessel function of the first kind of order 1."""
@_scal_elemwise @scalar_elemwise
def jv(v, x): def jv(v, x):
"""Bessel function of the first kind of order v (real).""" """Bessel function of the first kind of order v (real)."""
@_scal_elemwise @scalar_elemwise
def i0(x): def i0(x):
"""Modified Bessel function of the first kind of order 0.""" """Modified Bessel function of the first kind of order 0."""
@_scal_elemwise @scalar_elemwise
def i1(x): def i1(x):
"""Modified Bessel function of the first kind of order 1.""" """Modified Bessel function of the first kind of order 1."""
@_scal_elemwise @scalar_elemwise
def iv(v, x): def iv(v, x):
"""Modified Bessel function of the first kind of order v (real).""" """Modified Bessel function of the first kind of order v (real)."""
@_scal_elemwise @scalar_elemwise
def real(z): def real(z):
"""Return real component of complex-valued tensor `z`""" """Return real component of complex-valued tensor `z`"""
...@@ -2491,7 +2491,7 @@ def real(z): ...@@ -2491,7 +2491,7 @@ def real(z):
_tensor_py_operators.real = property(real) _tensor_py_operators.real = property(real)
@_scal_elemwise @scalar_elemwise
def imag(z): def imag(z):
"""Return imaginary component of complex-valued tensor `z`""" """Return imaginary component of complex-valued tensor `z`"""
...@@ -2499,22 +2499,22 @@ def imag(z): ...@@ -2499,22 +2499,22 @@ def imag(z):
_tensor_py_operators.imag = property(imag) _tensor_py_operators.imag = property(imag)
@_scal_elemwise @scalar_elemwise
def angle(z): def angle(z):
"""Return polar-coordinate angle of complex-valued tensor `z`""" """Return polar-coordinate angle of complex-valued tensor `z`"""
@_scal_elemwise # numpy.complex cannot build tensors @scalar_elemwise # numpy.complex cannot build tensors
def complex(real, imag): def complex(real, imag):
"""Return complex-valued tensor with `real` and `imag` components""" """Return complex-valued tensor with `real` and `imag` components"""
@_scal_elemwise @scalar_elemwise
def conj(z): def conj(z):
"""Return the complex conjugate of `z`.""" """Return the complex conjugate of `z`."""
@_scal_elemwise @scalar_elemwise
def complex_from_polar(abs, angle): def complex_from_polar(abs, angle):
"""Return complex-valued tensor from polar coordinate specification.""" """Return complex-valued tensor from polar coordinate specification."""
...@@ -2526,7 +2526,7 @@ def complex_from_polar(abs, angle): ...@@ -2526,7 +2526,7 @@ def complex_from_polar(abs, angle):
# fill, _fill_inplace = _elemwise(scal.second, 'fill', # fill, _fill_inplace = _elemwise(scal.second, 'fill',
# """fill WRITEME (elemwise)""") # """fill WRITEME (elemwise)""")
@_scal_elemwise @scalar_elemwise
def second(a, b): def second(a, b):
"""Create a matrix by filling the shape of a with b""" """Create a matrix by filling the shape of a with b"""
...@@ -3570,13 +3570,13 @@ setdefault = default # legacy ...@@ -3570,13 +3570,13 @@ setdefault = default # legacy
########################## ##########################
# Arithmetics # Arithmetics
########################## ##########################
@_scal_elemwise(symbolname="scalar_maximum") @scalar_elemwise(symbolname="scalar_maximum")
def maximum(x, y): def maximum(x, y):
"""elemwise maximum. See max for the maximum in one tensor""" """elemwise maximum. See max for the maximum in one tensor"""
# see decorator for function body # see decorator for function body
@_scal_elemwise(symbolname="scalar_minimum") @scalar_elemwise(symbolname="scalar_minimum")
def minimum(x, y): def minimum(x, y):
"""elemwise minimum. See min for the minimum in one tensor""" """elemwise minimum. See min for the minimum in one tensor"""
# see decorator for function body # see decorator for function body
...@@ -3587,31 +3587,31 @@ def divmod(x, y): ...@@ -3587,31 +3587,31 @@ def divmod(x, y):
return floor_div(x, y), mod_check(x, y) return floor_div(x, y), mod_check(x, y)
@_scal_elemwise @scalar_elemwise
def add(a, *other_terms): def add(a, *other_terms):
"""elementwise addition""" """elementwise addition"""
# see decorator for function body # see decorator for function body
@_scal_elemwise @scalar_elemwise
def sub(a, b): def sub(a, b):
"""elementwise subtraction""" """elementwise subtraction"""
# see decorator for function body # see decorator for function body
@_scal_elemwise @scalar_elemwise
def mul(a, *other_terms): def mul(a, *other_terms):
"""elementwise multiplication""" """elementwise multiplication"""
# see decorator for function body # see decorator for function body
@_scal_elemwise @scalar_elemwise
def true_div(a, b): def true_div(a, b):
"""elementwise [true] division (inverse of multiplication)""" """elementwise [true] division (inverse of multiplication)"""
# see decorator for function body # see decorator for function body
@_scal_elemwise @scalar_elemwise
def int_div(a, b): def int_div(a, b):
"""elementwise [floor] division (inverse of multiplication)""" """elementwise [floor] division (inverse of multiplication)"""
# see decorator for function body # see decorator for function body
...@@ -3654,19 +3654,19 @@ def mod_check(x, y): ...@@ -3654,19 +3654,19 @@ def mod_check(x, y):
return mod(x, y) return mod(x, y)
@_scal_elemwise @scalar_elemwise
def mod(a, b): def mod(a, b):
"""elementwise modulo""" """elementwise modulo"""
# see decorator for function body # see decorator for function body
@_scal_elemwise @scalar_elemwise
def pow(a, b): def pow(a, b):
"""elementwise power""" """elementwise power"""
# see decorator for function body # see decorator for function body
@_scal_elemwise @scalar_elemwise
def clip(x, min, max): def clip(x, min, max):
""" """
Clip x to be between min and max. Clip x to be between min and max.
......
...@@ -2242,7 +2242,7 @@ class ProdWithoutZeros(CAReduceDtype): ...@@ -2242,7 +2242,7 @@ class ProdWithoutZeros(CAReduceDtype):
return [a_grad] return [a_grad]
def _scal_elemwise(*symbol, nfunc=None, nin=None, nout=None, symbolname=None): def scalar_elemwise(*symbol, nfunc=None, nin=None, nout=None, symbolname=None):
"""Replace a symbol definition with an `Elemwise`-wrapped version of the corresponding scalar `Op`. """Replace a symbol definition with an `Elemwise`-wrapped version of the corresponding scalar `Op`.
If it is not ``None``, the `nfunc` argument should be a string such that If it is not ``None``, the `nfunc` argument should be a string such that
......
from theano import printing from theano import printing
from theano.printing import pprint from theano.printing import pprint
from theano.tensor.elemwise import DimShuffle, _scal_elemwise from theano.tensor.elemwise import DimShuffle, scalar_elemwise
@_scal_elemwise @scalar_elemwise
def lt_inplace(a, b): def lt_inplace(a, b):
"""a < b (inplace on a)""" """a < b (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def gt_inplace(a, b): def gt_inplace(a, b):
"""a > b (inplace on a)""" """a > b (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def le_inplace(a, b): def le_inplace(a, b):
"""a <= b (inplace on a)""" """a <= b (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def ge_inplace(a, b): def ge_inplace(a, b):
"""a >= b (inplace on a)""" """a >= b (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def eq_inplace(a, b): def eq_inplace(a, b):
"""a == b (inplace on a)""" """a == b (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def neq_inplace(a, b): def neq_inplace(a, b):
"""a != b (inplace on a)""" """a != b (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def and__inplace(a, b): def and__inplace(a, b):
"""bitwise a & b (inplace on a)""" """bitwise a & b (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def or__inplace(a, b): def or__inplace(a, b):
"""bitwise a | b (inplace on a)""" """bitwise a | b (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def xor_inplace(a, b): def xor_inplace(a, b):
"""bitwise a ^ b (inplace on a)""" """bitwise a ^ b (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def invert_inplace(a): def invert_inplace(a):
"""bitwise ~a (inplace on a)""" """bitwise ~a (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def abs__inplace(a): def abs__inplace(a):
"""|`a`| (inplace on `a`)""" """|`a`| (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def exp_inplace(a): def exp_inplace(a):
"""e^`a` (inplace on `a`)""" """e^`a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def exp2_inplace(a): def exp2_inplace(a):
"""2^`a` (inplace on `a`)""" """2^`a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def expm1_inplace(a): def expm1_inplace(a):
"""e^`a` - 1 (inplace on `a`)""" """e^`a` - 1 (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def neg_inplace(a): def neg_inplace(a):
"""-a (inplace on a)""" """-a (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def inv_inplace(a): def inv_inplace(a):
"""1.0/a (inplace on a)""" """1.0/a (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def log_inplace(a): def log_inplace(a):
"""base e logarithm of a (inplace on a)""" """base e logarithm of a (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def log1p_inplace(a): def log1p_inplace(a):
"""log(1+a)""" """log(1+a)"""
@_scal_elemwise @scalar_elemwise
def log2_inplace(a): def log2_inplace(a):
"""base 2 logarithm of a (inplace on a)""" """base 2 logarithm of a (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def log10_inplace(a): def log10_inplace(a):
"""base 10 logarithm of a (inplace on a)""" """base 10 logarithm of a (inplace on a)"""
@_scal_elemwise @scalar_elemwise
def sgn_inplace(a): def sgn_inplace(a):
"""sign of `a` (inplace on `a`)""" """sign of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def ceil_inplace(a): def ceil_inplace(a):
"""ceil of `a` (inplace on `a`)""" """ceil of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def floor_inplace(a): def floor_inplace(a):
"""floor of `a` (inplace on `a`)""" """floor of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def trunc_inplace(a): def trunc_inplace(a):
"""trunc of `a` (inplace on `a`)""" """trunc of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def round_half_to_even_inplace(a): def round_half_to_even_inplace(a):
"""round_half_to_even_inplace(a) (inplace on `a`)""" """round_half_to_even_inplace(a) (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def round_half_away_from_zero_inplace(a): def round_half_away_from_zero_inplace(a):
"""round_half_away_from_zero_inplace(a) (inplace on `a`)""" """round_half_away_from_zero_inplace(a) (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def sqr_inplace(a): def sqr_inplace(a):
"""square of `a` (inplace on `a`)""" """square of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def sqrt_inplace(a): def sqrt_inplace(a):
"""square root of `a` (inplace on `a`)""" """square root of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def deg2rad_inplace(a): def deg2rad_inplace(a):
"""convert degree `a` to radian(inplace on `a`)""" """convert degree `a` to radian(inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def rad2deg_inplace(a): def rad2deg_inplace(a):
"""convert radian `a` to degree(inplace on `a`)""" """convert radian `a` to degree(inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def cos_inplace(a): def cos_inplace(a):
"""cosine of `a` (inplace on `a`)""" """cosine of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def arccos_inplace(a): def arccos_inplace(a):
"""arccosine of `a` (inplace on `a`)""" """arccosine of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def sin_inplace(a): def sin_inplace(a):
"""sine of `a` (inplace on `a`)""" """sine of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def arcsin_inplace(a): def arcsin_inplace(a):
"""arcsine of `a` (inplace on `a`)""" """arcsine of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def tan_inplace(a): def tan_inplace(a):
"""tangent of `a` (inplace on `a`)""" """tangent of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def arctan_inplace(a): def arctan_inplace(a):
"""arctangent of `a` (inplace on `a`)""" """arctangent of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def arctan2_inplace(a, b): def arctan2_inplace(a, b):
"""arctangent of `a` / `b` (inplace on `a`)""" """arctangent of `a` / `b` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def cosh_inplace(a): def cosh_inplace(a):
"""hyperbolic cosine of `a` (inplace on `a`)""" """hyperbolic cosine of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def arccosh_inplace(a): def arccosh_inplace(a):
"""hyperbolic arc cosine of `a` (inplace on `a`)""" """hyperbolic arc cosine of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def sinh_inplace(a): def sinh_inplace(a):
"""hyperbolic sine of `a` (inplace on `a`)""" """hyperbolic sine of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def arcsinh_inplace(a): def arcsinh_inplace(a):
"""hyperbolic arc sine of `a` (inplace on `a`)""" """hyperbolic arc sine of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def tanh_inplace(a): def tanh_inplace(a):
"""hyperbolic tangent of `a` (inplace on `a`)""" """hyperbolic tangent of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def arctanh_inplace(a): def arctanh_inplace(a):
"""hyperbolic arc tangent of `a` (inplace on `a`)""" """hyperbolic arc tangent of `a` (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def erf_inplace(a): def erf_inplace(a):
"""error function""" """error function"""
@_scal_elemwise @scalar_elemwise
def erfc_inplace(a): def erfc_inplace(a):
"""complementary error function""" """complementary error function"""
@_scal_elemwise @scalar_elemwise
def erfcx_inplace(a): def erfcx_inplace(a):
"""scaled complementary error function""" """scaled complementary error function"""
@_scal_elemwise @scalar_elemwise
def gamma_inplace(a): def gamma_inplace(a):
"""gamma function""" """gamma function"""
@_scal_elemwise @scalar_elemwise
def gammaln_inplace(a): def gammaln_inplace(a):
"""log gamma function""" """log gamma function"""
@_scal_elemwise @scalar_elemwise
def psi_inplace(a): def psi_inplace(a):
"""derivative of log gamma function""" """derivative of log gamma function"""
@_scal_elemwise @scalar_elemwise
def tri_gamma_inplace(a): def tri_gamma_inplace(a):
"""second derivative of the log gamma function""" """second derivative of the log gamma function"""
@_scal_elemwise @scalar_elemwise
def chi2sf_inplace(x, k): def chi2sf_inplace(x, k):
"""chi squared survival function""" """chi squared survival function"""
@_scal_elemwise @scalar_elemwise
def j0_inplace(x): def j0_inplace(x):
"""Bessel function of the first kind of order 0.""" """Bessel function of the first kind of order 0."""
@_scal_elemwise @scalar_elemwise
def j1_inplace(x): def j1_inplace(x):
"""Bessel function of the first kind of order 1.""" """Bessel function of the first kind of order 1."""
@_scal_elemwise @scalar_elemwise
def jv_inplace(v, x): def jv_inplace(v, x):
"""Bessel function of the first kind of order v (real).""" """Bessel function of the first kind of order v (real)."""
@_scal_elemwise @scalar_elemwise
def i0_inplace(x): def i0_inplace(x):
"""Modified Bessel function of the first kind of order 0.""" """Modified Bessel function of the first kind of order 0."""
@_scal_elemwise @scalar_elemwise
def i1_inplace(x): def i1_inplace(x):
"""Modified Bessel function of the first kind of order 1.""" """Modified Bessel function of the first kind of order 1."""
@_scal_elemwise @scalar_elemwise
def iv_inplace(v, x): def iv_inplace(v, x):
"""Modified Bessel function of the first kind of order v (real).""" """Modified Bessel function of the first kind of order v (real)."""
@_scal_elemwise @scalar_elemwise
def second_inplace(a): def second_inplace(a):
"""Fill `a` with `b`""" """Fill `a` with `b`"""
...@@ -297,52 +297,52 @@ fill_inplace = second_inplace ...@@ -297,52 +297,52 @@ fill_inplace = second_inplace
pprint.assign(fill_inplace, printing.FunctionPrinter("fill=")) pprint.assign(fill_inplace, printing.FunctionPrinter("fill="))
@_scal_elemwise(symbolname="scalar_maximum_inplace") @scalar_elemwise(symbolname="scalar_maximum_inplace")
def maximum_inplace(a, b): def maximum_inplace(a, b):
"""elementwise addition (inplace on `a`)""" """elementwise addition (inplace on `a`)"""
@_scal_elemwise(symbolname="scalar_minimum_inplace") @scalar_elemwise(symbolname="scalar_minimum_inplace")
def minimum_inplace(a, b): def minimum_inplace(a, b):
"""elementwise addition (inplace on `a`)""" """elementwise addition (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def add_inplace(a, b): def add_inplace(a, b):
"""elementwise addition (inplace on `a`)""" """elementwise addition (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def sub_inplace(a, b): def sub_inplace(a, b):
"""elementwise subtraction (inplace on `a`)""" """elementwise subtraction (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def mul_inplace(a, b): def mul_inplace(a, b):
"""elementwise multiplication (inplace on `a`)""" """elementwise multiplication (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def true_div_inplace(a, b): def true_div_inplace(a, b):
"""elementwise division (inplace on `a`)""" """elementwise division (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def int_div_inplace(a, b): def int_div_inplace(a, b):
"""elementwise division (inplace on `a`)""" """elementwise division (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def mod_inplace(a, b): def mod_inplace(a, b):
"""elementwise modulo (inplace on `a`)""" """elementwise modulo (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def pow_inplace(a, b): def pow_inplace(a, b):
"""elementwise power (inplace on `a`)""" """elementwise power (inplace on `a`)"""
@_scal_elemwise @scalar_elemwise
def conj_inplace(a): def conj_inplace(a):
"""elementwise conjugate (inplace on `a`)""" """elementwise conjugate (inplace on `a`)"""
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论