Skip to content

Commit

Permalink
Fixed tests of check_grads in Python 3 (differences in function strin…
Browse files Browse the repository at this point in the history
…g representation between Python 2 and 3)
  • Loading branch information
dougalm committed Sep 6, 2017
1 parent dcf4f7d commit 4e517a0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion autograd/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def check_vjp(f, x):
assert scalar_close(vjv_numeric, vjv_exact), \
("Derivative (VJP) check of {} failed with arg {}:\n"
"analytic: {}\nnumeric: {}".format(
f, x, vjv_numeric, vjv_exact))
get_name(f), x, vjv_numeric, vjv_exact))

def check_jvp(f, x):
jvp = make_jvp(f, x)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def foo(x):
defvjp(foo, lambda ans, vs, gvs, x : lambda g: g * 2.001)

assert_raises_regexp(AssertionError,
"\(VJP\) check of .* foo .* failed",
"\(VJP\) check of foo failed",
lambda: check_grads(foo, modes=['rev'])(1.0))

def test_check_vjp_2nd_order_fail():
Expand All @@ -25,5 +25,5 @@ def bar(x):
defvjp(bar, lambda ans, vs, gvs, x : lambda g: g * 1.001)

assert_raises_regexp(AssertionError,
"\(VJP\) check of .* vjp_foo .* failed",
"\(VJP\) check of vjp_foo failed",
lambda: check_grads(foo, modes=['rev'])(1.0))

0 comments on commit 4e517a0

Please sign in to comment.