class_docstr: Tests of transformations on randomly generated functions.
class_docstr_tok: ["Tests","of","transformations","on","randomly","generated","functions","."]
code: def vjp_matches_fd(self, fun):
      vals = gen_vals(fun.in_vars)
      in_tangents = gen_vals(fun.in_vars)
      in_cotangents = gen_vals(fun.out_vars)
      fun = partial(eval_fun, fun)
      dyn_argnums = thin(range(len(vals)), 0.5)
      in_tangents = [in_tangents[i] for i in dyn_argnums]
      fun, vals = partial_argnums(fun, vals, dyn_argnums)
      ans1, out_tangents = jvp_fd(fun, vals, in_tangents)
      ans2, vjpfun = vjp(fun, *vals)
      out_cotangents = vjpfun(in_cotangents)
      check_all_close(ans1, ans2)
      inner_prod_fd = inner_prod(out_tangents, in_cotangents)
      inner_prod_ad = inner_prod(in_tangents, out_cotangents)
      check_close(inner_prod_fd, inner_prod_ad)
  
imports: from collections import namedtuple
  from functools import partial
  import numpy.random
  from absl.testing import absltest
  from absl.testing import parameterized
  import itertools
  import jax.numpy
  from jax import jit, jvp, vjp
  import jax._src.test_util
  from jax import config
  from jax._src.util import unzip2, safe_zip, safe_map
label_desc: Use image node_id 3 for calling the GeneratedFunTest obj's underlying member method code with example usage: obj.vjp_matches_fd(fun) without return types