提交 1bece41f authored 作者: nouiz's avatar nouiz

Merge pull request #795 from bouchnic/monoid

Monoid NEWS: Added sparse Binomial, csr_fbinomial, csc_fbinomial, csr_dbinomial, csc_dbinomial, Moved out of sparse sandbox: SpSum, sp_sum, ColScaleCSC, RowScaleCSC, col_scale, row_scale, Diag, diag, SquareDiagonal, square_diagonal, EnsureSortedIndices, ensure_sorted_indices, clean) added sparse.sqrt,sqr,log1p,floor,ceil,sgn,round_half_to_even,arctanh,tanh,arcsinh,sinh,arctan,arcsin,tan,sin}
...@@ -3138,6 +3138,7 @@ def structured_monoid(tensor_op): ...@@ -3138,6 +3138,7 @@ def structured_monoid(tensor_op):
data = tensor_op(data, *xs) data = tensor_op(data, *xs)
return CSM(x.format)(data, ind, ptr, shape) return CSM(x.format)(data, ind, ptr, shape)
wrapper.__name__ = str(tensor_op.scalar_op)
return wrapper return wrapper
return decorator return decorator
...@@ -3195,6 +3196,112 @@ def structured_add(x): ...@@ -3195,6 +3196,112 @@ def structured_add(x):
# see decorator for function body # see decorator for function body
# Sparse operation (map 0 to 0)
@structured_monoid(tensor.sin)
def sin(x):
"""Elemwise sinus of `x`.
"""
# see decorator for function body
@structured_monoid(tensor.tan)
def tan(x):
"""Elemwise tan of `x`.
"""
# see decorator for function body
@structured_monoid(tensor.arcsin)
def arcsin(x):
"""Elemwise arcsinus of `x`.
"""
# see decorator for function body
@structured_monoid(tensor.arctan)
def arctan(x):
"""Elemwise arctan of `x`.
"""
# see decorator for function body
@structured_monoid(tensor.sinh)
def sinh(x):
"""Elemwise sinh of `x`.
"""
# see decorator for function body
@structured_monoid(tensor.arcsinh)
def arcsinh(x):
"""Elemwise arcsinh of `x`.
"""
# see decorator for function body
@structured_monoid(tensor.tanh)
def tanh(x):
"""Elemwise tanh of `x`.
"""
# see decorator for function body
@structured_monoid(tensor.arctanh)
def arctanh(x):
"""Elemwise arctanh of `x`.
"""
# see decorator for function body
@structured_monoid(tensor.round_half_to_even)
def rint(x):
"""Elemwise round half to even of `x`.
"""
# see decorator for function body
@structured_monoid(tensor.sgn)
def sgn(x):
"""Elemwise signe of `x`.
"""
# see decorator for function body
@structured_monoid(tensor.ceil)
def ceil(x):
"""Elemwise ceiling of `x`.
"""
# see decorator for function body
@structured_monoid(tensor.floor)
def floor(x):
"""Elemwise floor of `x`.
"""
# see decorator for function body
@structured_monoid(tensor.log1p)
def log1p(x):
"""Elemwise log(1 + `x`).
"""
# see decorator for function body
@structured_monoid(tensor.sqr)
def sqr(x):
"""Elemwise `x` * `x`.
"""
# see decorator for function body
@structured_monoid(tensor.sqrt)
def sqrt(x):
"""Elemwise square root of `x`.
"""
# see decorator for function body
# Dot # Dot
class StructuredDot(gof.Op): class StructuredDot(gof.Op):
"""Structured Dot is like dot, except that only the """Structured Dot is like dot, except that only the
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论