提交 e503b3f0 authored 作者: Frederic's avatar Frederic

pep8

上级 08d16c0a
...@@ -289,6 +289,7 @@ DEVICE double _psi(double x){ ...@@ -289,6 +289,7 @@ DEVICE double _psi(double x){
return hash(type(self)) return hash(type(self))
psi = Psi(upgrade_to_float, name='psi') psi = Psi(upgrade_to_float, name='psi')
class Chi2SF(BinaryScalarOp): class Chi2SF(BinaryScalarOp):
""" """
Compute (1 - chi2_cdf(x)) Compute (1 - chi2_cdf(x))
...@@ -298,11 +299,13 @@ class Chi2SF(BinaryScalarOp): ...@@ -298,11 +299,13 @@ class Chi2SF(BinaryScalarOp):
@staticmethod @staticmethod
def st_impl(x, k): def st_impl(x, k):
return scipy.stats.chi2.sf(x, k) return scipy.stats.chi2.sf(x, k)
def impl(self, x, k): def impl(self, x, k):
if imported_scipy_special: if imported_scipy_special:
return Chi2SF.st_impl(x, k) return Chi2SF.st_impl(x, k)
else: else:
super(Chi2SF, self).impl(x, k) super(Chi2SF, self).impl(x, k)
def c_support_code(self): def c_support_code(self):
return( return(
""" """
...@@ -557,9 +560,7 @@ class Chi2SF(BinaryScalarOp): ...@@ -557,9 +560,7 @@ class Chi2SF(BinaryScalarOp):
} }
""") """)
def c_code(self, node, name, inp, out, sub): def c_code(self, node, name, inp, out, sub):
x, k = inp x, k = inp
z, = out z, = out
if node.inputs[0].type in float_types: if node.inputs[0].type in float_types:
...@@ -570,6 +571,7 @@ class Chi2SF(BinaryScalarOp): ...@@ -570,6 +571,7 @@ class Chi2SF(BinaryScalarOp):
def __eq__(self, other): def __eq__(self, other):
return type(self) == type(other) return type(self) == type(other)
def __hash__(self): def __hash__(self):
return hash(type(self)) return hash(type(self))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论