提交 586de543 authored 作者: Matt Graham's avatar Matt Graham

Adding separate test functions for Iv/Jv gradients.

上级 e5d9cbc8
......@@ -1943,6 +1943,10 @@ _good_broadcast_binary_bessel = dict(
uint16=(randint_ranged(0, 5, (2, 3)).astype('uint16'),
randint_ranged(0, 10, (2, 3)).astype('uint16')))
_grad_broadcast_binary_bessel = dict(
normal=(rand_ranged(1, 5, (2, 3)),
rand_ranged(0, 10, (2, 3))))
J0Tester = makeBroadcastTester(
op=tensor.j0,
expected=expected_j0,
......@@ -1998,6 +2002,21 @@ JvInplaceTester = makeBroadcastTester(
inplace=True,
skip=skip_scipy)
def test_verify_jv_grad():
"""Verify Jv gradient.
Implemented separately due to need to fix first input for which grad is
not defined.
"""
v_val, x_val = _grad_broadcast_binary_bessel['normal']
def fixed_first_input_jv(x):
return tensor.jv(v_val, x)
utt.verify_grad(fixed_first_input_jv, [x_val])
I0Tester = makeBroadcastTester(
op=tensor.i0,
expected=expected_i0,
......@@ -2053,6 +2072,21 @@ IvInplaceTester = makeBroadcastTester(
inplace=True,
skip=skip_scipy)
def test_verify_iv_grad():
"""Verify Iv gradient.
Implemented separately due to need to fix first input for which grad is
not defined.
"""
v_val, x_val = _grad_broadcast_binary_bessel['normal']
def fixed_first_input_iv(x):
return tensor.iv(v_val, x)
utt.verify_grad(fixed_first_input_iv, [x_val])
ZerosLikeTester = makeBroadcastTester(
op=tensor.zeros_like,
expected=numpy.zeros_like,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论