提交 cdc32336 authored 作者: Dustin Webb's avatar Dustin Webb

Fixed issue with pow grad function trying to evalutate log at 0. Issue 1780

Added unit test. Note: issue still occurs in debugmode.
上级 c6c7aba4
......@@ -1701,6 +1701,7 @@ class Pow(BinaryScalarOp):
first_part = gz * y * x ** (y - 1)
second_part = gz * log(x) * x ** y
second_part = switch(eq(x, 0), 0, second_part)
return (first_part, second_part)
......
......@@ -926,6 +926,10 @@ _grad_broadcast_pow_normal = dict(same_shapes = (rand_ranged(1, 5, (2, 3)), rand
#empty2 case is not supported by numpy.
_good_broadcast_pow_normal_float_pow = copy(_good_broadcast_pow_normal_float)
del _good_broadcast_pow_normal_float_pow["empty2"]
_grad_broadcast_pow_normal["x_eq_zero"] = (
numpy.asarray([0.], dtype=config.floatX),
numpy.asarray([2.], dtype=config.floatX)
)
PowTester = makeBroadcastTester(
op=pow,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论