提交 659c98b6 authored 作者: Nicolas Bouchard's avatar Nicolas Bouchard 提交者: Frederic

pep8

上级 2a28db96
...@@ -58,39 +58,14 @@ class Cast(gof.op.Op): ...@@ -58,39 +58,14 @@ class Cast(gof.op.Op):
def __str__(self): def __str__(self):
return "%s(%s)" % (self.__class__.__name__, self.out_type) return "%s(%s)" % (self.__class__.__name__, self.out_type)
bcast = Cast('int8')
def cast(x, t): wcast = Cast('int16')
"""Cast sparse variable `x` to the desired dtype `t`. icast = Cast('int32')
lcast = Cast('int64')
This wrap the method astype from scipy. fcast = Cast('float32')
dcast = Cast('float64')
:Parameters: ccast = Cast('complex64')
- `x`: Sparse array zcast = Cast('complex128')
- `t`: dtype
"""
return Cast(t)(x)
def fcast(x):
"""Cast sparse variable `x` to `float32`.
This wrap the method astype from scipy.
:Parameters:
- `x`: Sparse array
"""
return Cast('float32')(x)
def dcast(x):
"""Cast sparse variable `x` to `float64`.
This wrap the method astype from scipy.
:Parameters:
- `x`: Sparse array
"""
return Cast('float64')(x)
class HStack(gof.op.Op): class HStack(gof.op.Op):
...@@ -676,18 +651,21 @@ def structured_sigmoid(x): ...@@ -676,18 +651,21 @@ def structured_sigmoid(x):
""" """
# see decorator for function body # see decorator for function body
@structured_monoid(tensor.exp) @structured_monoid(tensor.exp)
def structured_exp(x): def structured_exp(x):
"""structured elemwise exponential. """structured elemwise exponential.
""" """
# see decorator for function body # see decorator for function body
@structured_monoid(tensor.log) @structured_monoid(tensor.log)
def structured_log(x): def structured_log(x):
"""structured elemwise logarithm. """structured elemwise logarithm.
""" """
# see decorator for function body # see decorator for function body
@structured_monoid(tensor.pow) @structured_monoid(tensor.pow)
def structured_pow(x, y): def structured_pow(x, y):
"""structured elemwise power of sparse matrix """structured elemwise power of sparse matrix
...@@ -695,6 +673,7 @@ def structured_pow(x, y): ...@@ -695,6 +673,7 @@ def structured_pow(x, y):
""" """
# see decorator for function body # see decorator for function body
@structured_monoid(tensor.minimum) @structured_monoid(tensor.minimum)
def structured_minimum(x, y): def structured_minimum(x, y):
"""structured elemwise minimum of sparse matrix """structured elemwise minimum of sparse matrix
...@@ -702,6 +681,7 @@ def structured_minimum(x, y): ...@@ -702,6 +681,7 @@ def structured_minimum(x, y):
""" """
# see decorator for function body # see decorator for function body
@structured_monoid(tensor.maximum) @structured_monoid(tensor.maximum)
def structured_maximum(x, y): def structured_maximum(x, y):
"""structured elemwise maximum of sparse matrix """structured elemwise maximum of sparse matrix
...@@ -709,6 +689,7 @@ def structured_maximum(x, y): ...@@ -709,6 +689,7 @@ def structured_maximum(x, y):
""" """
# see decorator for function body # see decorator for function body
@structured_monoid(tensor.add) @structured_monoid(tensor.add)
def structured_add(x): def structured_add(x):
"""structured addition of sparse matrix """structured addition of sparse matrix
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论