提交 73d2d0a3 authored 作者: affanv14's avatar affanv14

Changed grad to L_op in basic_scipy.py

上级 d92efdc7
...@@ -30,12 +30,12 @@ class Erf(UnaryScalarOp): ...@@ -30,12 +30,12 @@ class Erf(UnaryScalarOp):
else: else:
super(Erf, self).impl(x) super(Erf, self).impl(x)
def grad(self, inp, grads): def L_op(self, inputs, outputs, grads):
x, = inp x, = inputs
gz, = grads gz, = grads
if x.type in complex_types: if x.type in complex_types:
raise NotImplementedError() raise NotImplementedError()
if self(x).type in discrete_types: if outputs[0].type in discrete_types:
if x.type in discrete_types: if x.type in discrete_types:
return [x.zeros_like(dtype=theano.config.floatX)] return [x.zeros_like(dtype=theano.config.floatX)]
else: else:
...@@ -61,12 +61,12 @@ class Erfc(UnaryScalarOp): ...@@ -61,12 +61,12 @@ class Erfc(UnaryScalarOp):
else: else:
super(Erfc, self).impl(x) super(Erfc, self).impl(x)
def grad(self, inp, grads): def L_op(self, inputs, outputs, grads):
x, = inp x, = inputs
gz, = grads gz, = grads
if x.type in complex_types: if x.type in complex_types:
raise NotImplementedError() raise NotImplementedError()
if self(x).type in discrete_types: if outputs[0].type in discrete_types:
if x.type in discrete_types: if x.type in discrete_types:
return [x.zeros_like(dtype=theano.config.floatX)] return [x.zeros_like(dtype=theano.config.floatX)]
else: else:
...@@ -108,12 +108,12 @@ class Erfcx(UnaryScalarOp): ...@@ -108,12 +108,12 @@ class Erfcx(UnaryScalarOp):
else: else:
super(Erfcx, self).impl(x) super(Erfcx, self).impl(x)
def grad(self, inp, grads): def L_op(self, inputs, outputs, grads):
x, = inp x, = inputs
gz, = grads gz, = grads
if x.type in complex_types: if x.type in complex_types:
raise NotImplementedError() raise NotImplementedError()
if self(x).type in discrete_types: if outputs[0].type in discrete_types:
if x.type in discrete_types: if x.type in discrete_types:
return [x.zeros_like(dtype=theano.config.floatX)] return [x.zeros_like(dtype=theano.config.floatX)]
else: else:
...@@ -144,12 +144,12 @@ class Erfinv(UnaryScalarOp): ...@@ -144,12 +144,12 @@ class Erfinv(UnaryScalarOp):
else: else:
super(Erfinv, self).impl(x) super(Erfinv, self).impl(x)
def grad(self, inp, grads): def L_op(self, inputs, outputs, grads):
x, = inp x, = inputs
gz, = grads gz, = grads
if x.type in complex_types: if x.type in complex_types:
raise NotImplementedError() raise NotImplementedError()
if self(x).type in discrete_types: if outputs[0].type in discrete_types:
if x.type in discrete_types: if x.type in discrete_types:
return [x.zeros_like(dtype=theano.config.floatX)] return [x.zeros_like(dtype=theano.config.floatX)]
else: else:
...@@ -177,12 +177,12 @@ class Erfcinv(UnaryScalarOp): ...@@ -177,12 +177,12 @@ class Erfcinv(UnaryScalarOp):
else: else:
super(Erfcinv, self).impl(x) super(Erfcinv, self).impl(x)
def grad(self, inp, grads): def L_op(self, inputs, outputs, grads):
x, = inp x, = inputs
gz, = grads gz, = grads
if x.type in complex_types: if x.type in complex_types:
raise NotImplementedError() raise NotImplementedError()
if self(x).type in discrete_types: if outputs[0].type in discrete_types:
if x.type in discrete_types: if x.type in discrete_types:
return [x.zeros_like(dtype=theano.config.floatX)] return [x.zeros_like(dtype=theano.config.floatX)]
else: else:
...@@ -214,12 +214,12 @@ class Gamma(UnaryScalarOp): ...@@ -214,12 +214,12 @@ class Gamma(UnaryScalarOp):
else: else:
super(Gamma, self).impl(x) super(Gamma, self).impl(x)
def grad(self, inputs, gout): def L_op(self, inputs, outputs, gout):
(x,) = inputs (x,) = inputs
(gz,) = gout (gz,) = gout
if x.type in complex_types: if x.type in complex_types:
raise NotImplementedError() raise NotImplementedError()
if self(x).type in discrete_types: if outputs[0].type in discrete_types:
if x.type in discrete_types: if x.type in discrete_types:
return [x.zeros_like(dtype=theano.config.floatX)] return [x.zeros_like(dtype=theano.config.floatX)]
else: else:
...@@ -251,12 +251,12 @@ class GammaLn(UnaryScalarOp): ...@@ -251,12 +251,12 @@ class GammaLn(UnaryScalarOp):
else: else:
super(GammaLn, self).impl(x) super(GammaLn, self).impl(x)
def grad(self, inp, grads): def L_op(self, inputs, outputs, grads):
x, = inp x, = inputs
gz, = grads gz, = grads
if x.type in complex_types: if x.type in complex_types:
raise NotImplementedError() raise NotImplementedError()
if self(x).type in discrete_types: if outputs[0].type in discrete_types:
if x.type in discrete_types: if x.type in discrete_types:
return [x.zeros_like(dtype=theano.config.floatX)] return [x.zeros_like(dtype=theano.config.floatX)]
else: else:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论